aboutsummaryrefslogtreecommitdiff
path: root/base
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2024-04-24 17:01:09 +0100
committergingerBill <bill@gingerbill.org>2024-04-24 17:01:09 +0100
commit214537b4209211f9ceb9932b8d9980ea6503e8ea (patch)
tree8ccecfad8be31642407683958ffa826682a7a061 /base
parentc330e5b5c1b512e1b0ca7181941057e5f2e085e4 (diff)
Improve codegen for `bit_field [N]T` compound literals
Diffstat (limited to 'base')
-rw-r--r--base/runtime/internal.odin10
1 files changed, 4 insertions, 6 deletions
diff --git a/base/runtime/internal.odin b/base/runtime/internal.odin
index 6ca61c721..6f0445787 100644
--- a/base/runtime/internal.odin
+++ b/base/runtime/internal.odin
@@ -1042,19 +1042,17 @@ fixdfti :: proc(a: u64) -> i128 {
__write_bits :: proc "contextless" (dst, src: [^]byte, offset: uintptr, size: uintptr) {
for i in 0..<size {
j := offset+i
- the_bit := byte((src[i/8]) & (1<<(i&7)) != 0)
+ the_bit := byte((src[i>>3]) & (1<<(i&7)) != 0)
b := the_bit<<(j&7)
- dst[j/8] &~= b
- dst[j/8] |= b
+ dst[j>>3] = (dst[j>>3] &~ b) | b
}
}
__read_bits :: proc "contextless" (dst, src: [^]byte, offset: uintptr, size: uintptr) {
for j in 0..<size {
i := offset+j
- the_bit := byte((src[i/8]) & (1<<(i&7)) != 0)
+ the_bit := byte((src[i>>3]) & (1<<(i&7)) != 0)
b := the_bit<<(j&7)
- dst[j/8] &~= b
- dst[j/8] |= b
+ dst[j>>3] = (dst[j>>3] &~ b) | b
}
} \ No newline at end of file