diff options
| author | Nathan Reiner <nathan@nathanreiner.xyz> | 2025-08-18 17:45:13 +0200 |
|---|---|---|
| committer | Nathan Reiner <nathan@nathanreiner.xyz> | 2025-08-18 17:45:13 +0200 |
| commit | 33e1de2710fe44512440e0e6055578d67dab330c (patch) | |
| tree | df8198ac5147f466bba600ca06dc1a319099d185 /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.zig | 18 |
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, + }; + } +}; |