aboutsummaryrefslogtreecommitdiff
path: root/src/types.zig
diff options
context:
space:
mode:
authorNathan Reiner <nathan@nathanreiner.xyz>2025-08-18 17:45:13 +0200
committerNathan Reiner <nathan@nathanreiner.xyz>2025-08-18 17:45:13 +0200
commit33e1de2710fe44512440e0e6055578d67dab330c (patch)
treedf8198ac5147f466bba600ca06dc1a319099d185 /src/types.zig
First sketch of wayland interface
**WARNING** this implementation is not working properly yet.
Diffstat (limited to 'src/types.zig')
-rw-r--r--src/types.zig18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/types.zig b/src/types.zig
new file mode 100644
index 0000000..2849af1
--- /dev/null
+++ b/src/types.zig
@@ -0,0 +1,18 @@
+const std = @import("std");
+
+pub const Fd = struct { fd: std.posix.fd_t };
+
+pub const Fixed = struct {
+ n: u24,
+ f: u8,
+
+ pub fn from_f64(float: f64) @This() {
+ const n: u24 = @intFromFloat(float);
+ const f: u8 = @intFromFloat(std.math.maxInt(u8) * (float - @as(f64, @floatFromInt(n))));
+
+ return .{
+ .n = n,
+ .f = f,
+ };
+ }
+};