Browse Source

Minor style change

gingerBill 1 year ago
parent
commit
62911539cd
2 changed files with 8 additions and 8 deletions
  1. 6 6
      core/bytes/bytes.odin
  2. 2 2
      core/strings/builder.odin

+ 6 - 6
core/bytes/bytes.odin

@@ -348,7 +348,7 @@ index_byte :: proc(s: []byte, c: byte) -> (index: int) #no_bounds_check {
 		return -1
 		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
 	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
 	tail := length - (length - alignment_start) % SIMD_SCAN_WIDTH
 
 
 	for /**/; i < tail; i += 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)
 		comparison := intrinsics.simd_lanes_eq(load, scanner)
 		match := intrinsics.simd_reduce_or(comparison)
 		match := intrinsics.simd_reduce_or(comparison)
 		if match > 0 {
 		if match > 0 {
 			sentinel: #simd[SIMD_SCAN_WIDTH]u8 = u8(0xFF)
 			sentinel: #simd[SIMD_SCAN_WIDTH]u8 = u8(0xFF)
 			index_select := intrinsics.simd_select(comparison, simd_scanner_indices, sentinel)
 			index_select := intrinsics.simd_select(comparison, simd_scanner_indices, sentinel)
 			index_reduce := intrinsics.simd_reduce_min(index_select)
 			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
 		return -1
 	}
 	}
 
 
-	ptr := cast(int)cast(uintptr)raw_data(s)
+	ptr := int(uintptr(raw_data(s)))
 
 
 	tail := length - (ptr + length) % SIMD_SCAN_WIDTH
 	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
 	i -= SIMD_SCAN_WIDTH - 1
 
 
 	for /**/; i >= alignment_start; i -= SIMD_SCAN_WIDTH {
 	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)
 		comparison := intrinsics.simd_lanes_eq(load, scanner)
 		match := intrinsics.simd_reduce_or(comparison)
 		match := intrinsics.simd_reduce_or(comparison)
 		if match > 0 {
 		if match > 0 {
 			sentinel: #simd[SIMD_SCAN_WIDTH]u8
 			sentinel: #simd[SIMD_SCAN_WIDTH]u8
 			index_select := intrinsics.simd_select(comparison, simd_scanner_indices, sentinel)
 			index_select := intrinsics.simd_select(comparison, simd_scanner_indices, sentinel)
 			index_reduce := intrinsics.simd_reduce_max(index_select)
 			index_reduce := intrinsics.simd_reduce_max(index_select)
-			return i + cast(int)index_reduce
+			return i + int(index_reduce)
 		}
 		}
 	}
 	}
 
 

+ 2 - 2
core/strings/builder.odin

@@ -516,7 +516,7 @@ pop_byte :: proc(b: ^Builder) -> (r: byte) {
 	}
 	}
 
 
 	r = b.buf[len(b.buf)-1]
 	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)
 	d.len = max(d.len-1, 0)
 	return
 	return
 }
 }
@@ -536,7 +536,7 @@ pop_rune :: proc(b: ^Builder) -> (r: rune, width: int) {
 	}
 	}
 
 
 	r, width = utf8.decode_last_rune(b.buf[:])
 	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)
 	d.len = max(d.len-width, 0)
 	return
 	return
 }
 }