mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-27 22:09:09 +00:00
only conditionally flip a bit
This commit is contained in:
parent
49708cfff8
commit
106f1311d2
1 changed files with 6 additions and 3 deletions
|
@ -66,11 +66,14 @@ fn capacityOfLevel(input: usize) usize {
|
||||||
const Alignment = extern struct {
|
const Alignment = extern struct {
|
||||||
bits: u8,
|
bits: u8,
|
||||||
|
|
||||||
const VALUE_BEFORE_KEY_FLAG = 0b1000_0000;
|
const VALUE_BEFORE_KEY_FLAG: u8 = 0b1000_0000;
|
||||||
|
|
||||||
fn toU32(self: Alignment) u32 {
|
fn toU32(self: Alignment) u32 {
|
||||||
// xor to wipe the leftmost bit
|
if (self.bits & Alignment.VALUE_BEFORE_KEY_FLAG == 1) {
|
||||||
return self.bits ^ Alignment.VALUE_BEFORE_KEY_FLAG;
|
return self.bits ^ Alignment.VALUE_BEFORE_KEY_FLAG;
|
||||||
|
} else {
|
||||||
|
return self.bits;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn keyFirst(self: Alignment) bool {
|
fn keyFirst(self: Alignment) bool {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue