rename intrinsics
This commit is contained in:
@@ -14,7 +14,7 @@ check_float func() i32 {
|
||||
|
||||
check_unsigned func() i32 {
|
||||
n u32 = 100
|
||||
n = div_trunc(n, 7) # 14
|
||||
n = divtrunc!(n, 7) # 14
|
||||
n -= 4 # 10
|
||||
if n == 10 {
|
||||
return 1
|
||||
@@ -27,7 +27,7 @@ main func() i32 {
|
||||
total += 10 # 10
|
||||
total -= 3 # 7
|
||||
total *= 4 # 28
|
||||
total = div_trunc(total, 2) # 14
|
||||
total = divtrunc!(total, 2) # 14
|
||||
|
||||
# binary operators honour precedence: 14 + (2 * 3) - 4 == 16
|
||||
total = total + 2 * 3 - 4
|
||||
|
||||
@@ -2,7 +2,7 @@ mem :: import "@std/mem"
|
||||
|
||||
_probe_count func(context ?*mut anyopaque) void {
|
||||
if context |raw| {
|
||||
counts *mut usize :: ptr_cast(usize, raw)
|
||||
counts *mut usize :: ptrcast!(usize, raw)
|
||||
counts[0] += 1
|
||||
}
|
||||
}
|
||||
@@ -28,7 +28,7 @@ _probe_vtable mem.AllocatorVTable :: mem.AllocatorVTable {
|
||||
}
|
||||
|
||||
typed_allocator_test func() i32 {
|
||||
if (size_of(mem.Allocator) != 16) return 31
|
||||
if (sizeof!(mem.Allocator) != 16) return 31
|
||||
|
||||
first_calls [1]mut usize = [0]
|
||||
second_calls [1]mut usize = [0]
|
||||
@@ -76,7 +76,7 @@ typed_allocator_test func() i32 {
|
||||
}
|
||||
if (overflow_fallback_failed) return 37
|
||||
overflow_failed bool = false
|
||||
_ = mem.alloc(u64, first_allocator, max_value(usize)) catch |_| {
|
||||
_ = mem.alloc(u64, first_allocator, maxval!(usize)) catch |_| {
|
||||
overflow_failed = true
|
||||
yield overflow_fallback
|
||||
}
|
||||
|
||||
@@ -39,6 +39,6 @@ main func() i32 {
|
||||
if (pointer.value != 42) return 4
|
||||
buffer Buffer(u8, 4) :: Buffer(u8, 4) { values = [1, 2, 3, 4] }
|
||||
if (buffer.values.len != 4) return 2
|
||||
if (size_of(Buffer(u8, 4)) != 4) return 5
|
||||
if (sizeof!(Buffer(u8, 4)) != 4) return 5
|
||||
return 0
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user