mirror of
https://github.com/odin-lang/Odin.git
synced 2026-04-19 04:50:29 +00:00
Minor style change
This commit is contained in:
@@ -348,7 +348,7 @@ index_byte :: proc(s: []byte, c: byte) -> (index: int) #no_bounds_check {
|
||||
return -1
|
||||
}
|
||||
|
||||
ptr := cast(int)cast(uintptr)raw_data(s)
|
||||
ptr := int(uintptr(raw_data(s)))
|
||||
|
||||
alignment_start := (SIMD_SCAN_WIDTH - ptr % SIMD_SCAN_WIDTH) % SIMD_SCAN_WIDTH
|
||||
|
||||
@@ -367,14 +367,14 @@ index_byte :: proc(s: []byte, c: byte) -> (index: int) #no_bounds_check {
|
||||
tail := length - (length - alignment_start) % SIMD_SCAN_WIDTH
|
||||
|
||||
for /**/; i < tail; i += SIMD_SCAN_WIDTH {
|
||||
load := (cast(^#simd[SIMD_SCAN_WIDTH]u8)(&s[i]))^
|
||||
load := (^#simd[SIMD_SCAN_WIDTH]u8)(&s[i])^
|
||||
comparison := intrinsics.simd_lanes_eq(load, scanner)
|
||||
match := intrinsics.simd_reduce_or(comparison)
|
||||
if match > 0 {
|
||||
sentinel: #simd[SIMD_SCAN_WIDTH]u8 = u8(0xFF)
|
||||
index_select := intrinsics.simd_select(comparison, simd_scanner_indices, sentinel)
|
||||
index_reduce := intrinsics.simd_reduce_min(index_select)
|
||||
return i + cast(int)index_reduce
|
||||
return i + int(index_reduce)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -415,7 +415,7 @@ last_index_byte :: proc(s: []byte, c: byte) -> int #no_bounds_check {
|
||||
return -1
|
||||
}
|
||||
|
||||
ptr := cast(int)cast(uintptr)raw_data(s)
|
||||
ptr := int(uintptr(raw_data(s)))
|
||||
|
||||
tail := length - (ptr + length) % SIMD_SCAN_WIDTH
|
||||
|
||||
@@ -436,14 +436,14 @@ last_index_byte :: proc(s: []byte, c: byte) -> int #no_bounds_check {
|
||||
i -= SIMD_SCAN_WIDTH - 1
|
||||
|
||||
for /**/; i >= alignment_start; i -= SIMD_SCAN_WIDTH {
|
||||
load := (cast(^#simd[SIMD_SCAN_WIDTH]u8)(&s[i]))^
|
||||
load := (^#simd[SIMD_SCAN_WIDTH]u8)(&s[i])^
|
||||
comparison := intrinsics.simd_lanes_eq(load, scanner)
|
||||
match := intrinsics.simd_reduce_or(comparison)
|
||||
if match > 0 {
|
||||
sentinel: #simd[SIMD_SCAN_WIDTH]u8
|
||||
index_select := intrinsics.simd_select(comparison, simd_scanner_indices, sentinel)
|
||||
index_reduce := intrinsics.simd_reduce_max(index_select)
|
||||
return i + cast(int)index_reduce
|
||||
return i + int(index_reduce)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -516,7 +516,7 @@ pop_byte :: proc(b: ^Builder) -> (r: byte) {
|
||||
}
|
||||
|
||||
r = b.buf[len(b.buf)-1]
|
||||
d := cast(^runtime.Raw_Dynamic_Array)&b.buf
|
||||
d := (^runtime.Raw_Dynamic_Array)(&b.buf)
|
||||
d.len = max(d.len-1, 0)
|
||||
return
|
||||
}
|
||||
@@ -536,7 +536,7 @@ pop_rune :: proc(b: ^Builder) -> (r: rune, width: int) {
|
||||
}
|
||||
|
||||
r, width = utf8.decode_last_rune(b.buf[:])
|
||||
d := cast(^runtime.Raw_Dynamic_Array)&b.buf
|
||||
d := (^runtime.Raw_Dynamic_Array)(&b.buf)
|
||||
d.len = max(d.len-width, 0)
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user