This commit is contained in:
gingerBill
2024-04-30 09:10:00 +01:00
parent ff0973e0f5
commit 5c1201fa42

View File

@@ -1043,8 +1043,8 @@ __write_bits :: proc "contextless" (dst, src: [^]byte, offset: uintptr, size: ui
for i in 0..<size {
j := offset+i
the_bit := byte((src[i>>3]) & (1<<(i&7)) != 0)
b := the_bit<<(j&7)
dst[j>>3] = (dst[j>>3] &~ b) | b
dst[j>>3] &~= 1<<(j&7)
dst[j>>3] |= the_bit<<(j&7)
}
}
@@ -1052,7 +1052,7 @@ __read_bits :: proc "contextless" (dst, src: [^]byte, offset: uintptr, size: uin
for j in 0..<size {
i := offset+j
the_bit := byte((src[i>>3]) & (1<<(i&7)) != 0)
b := the_bit<<(j&7)
dst[j>>3] = (dst[j>>3] &~ b) | b
dst[j>>3] &~= 1<<(j&7)
dst[j>>3] |= the_bit<<(j&7)
}
}