Created
January 10, 2020 15:13
-
-
Save ikskuh/0e49fe71698c10f61d7d1e76b373d380 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fixed_22_10 = arithmetic(i32) { | |
const Self = @This(); | |
fn add(lhs: Self, rhs: Self) Self { | |
return @as(Self, @value(lhs) + @value(rhs)); | |
} | |
fn mul(lhs: Self, rhs: Self) Self { | |
return @as(Self, (@as(i64, @value(lhs)) * @as(i64, @value(rhs))) / 1024); | |
} | |
// ... | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment