Skip to content

Commit a45a48a

Browse files
committed
quark_hotkeyd: revert bitwise stuff
1 parent 518dc24 commit a45a48a

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

src/quark_hotkeyd/main.nim

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,13 @@ proc set(self: var KeyBitSet, code: KeyCode, down: bool) {.inline.} =
4141
let idx = uint16(code.ord) shr 6
4242
let mask = 1'u64 shl (uint16(code.ord) and 63)
4343

44-
if idx < uint16(self.bits.len):
45-
self.bits[idx] = (self.bits[idx] and not mask) or (uint64(down) and mask)
44+
if idx >= uint16(self.bits.len):
45+
return
46+
47+
if down:
48+
self.bits[idx] = self.bits[idx] or mask
49+
else:
50+
self.bits[idx] = self.bits[idx] and (not mask)
4651

4752
proc get(self: KeyBitSet, code: KeyCode): bool {.inline.} =
4853
let idx = uint16(code.ord) shr 6

0 commit comments

Comments
 (0)