Commit 497eb31820

Noam Preil <pleasantatk@gmail.com>
2020-05-17 10:34:18
Fix the dumb in x86 too
1 parent 6385545
Changed files (1)
src-self-hosted
backend
src-self-hosted/backend/x86.zig
@@ -19,12 +19,7 @@ pub const Register = enum(u8) {
     }
 
     pub fn id(self: @This()) u3 {
-        return @intCast(u4, switch (@enumToInt(self)) {
-            0...7 => |i| i,
-            8...15 => |i| i - 8,
-            16...23 => |i| i - 16,
-            else => unreachable,
-        });
+        return @truncate(u3, @enumToInt(self));
     }
     
 };