mirror of
https://github.com/odin-lang/Odin.git
synced 2026-01-01 19:02:13 +00:00
Replace inline uses in the rest of core with #force_inline
This commit is contained in:
@@ -114,10 +114,10 @@ abs :: proc(a: $T) -> (out: T) where IS_NUMERIC(ELEM_TYPE(T)) {
|
||||
sign :: proc(a: $T) -> (out: T) where IS_NUMERIC(ELEM_TYPE(T)) {
|
||||
when IS_ARRAY(T) {
|
||||
for i in 0..<len(T) {
|
||||
out[i] = inline math.sign(a[i]);
|
||||
out[i] = #force_inline math.sign(a[i]);
|
||||
}
|
||||
} else {
|
||||
out = inline math.sign(a);
|
||||
out = #force_inline math.sign(a);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -376,10 +376,10 @@ pow :: proc(x, e: $T) -> (out: T) where IS_FLOAT(ELEM_TYPE(T)) {
|
||||
ceil :: proc(x: $T) -> (out: T) where IS_FLOAT(ELEM_TYPE(T)) {
|
||||
when IS_ARRAY(T) {
|
||||
for i in 0..<len(T) {
|
||||
out[i] = inline math.ceil(x[i]);
|
||||
out[i] = #force_inline math.ceil(x[i]);
|
||||
}
|
||||
} else {
|
||||
out = inline math.ceil(x);
|
||||
out = #force_inline math.ceil(x);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -387,10 +387,10 @@ ceil :: proc(x: $T) -> (out: T) where IS_FLOAT(ELEM_TYPE(T)) {
|
||||
floor :: proc(x: $T) -> (out: T) where IS_FLOAT(ELEM_TYPE(T)) {
|
||||
when IS_ARRAY(T) {
|
||||
for i in 0..<len(T) {
|
||||
out[i] = inline math.floor(x[i]);
|
||||
out[i] = #force_inline math.floor(x[i]);
|
||||
}
|
||||
} else {
|
||||
out = inline math.floor(x);
|
||||
out = #force_inline math.floor(x);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -398,21 +398,21 @@ floor :: proc(x: $T) -> (out: T) where IS_FLOAT(ELEM_TYPE(T)) {
|
||||
round :: proc(x: $T) -> (out: T) where IS_FLOAT(ELEM_TYPE(T)) {
|
||||
when IS_ARRAY(T) {
|
||||
for i in 0..<len(T) {
|
||||
out[i] = inline math.round(x[i]);
|
||||
out[i] = #force_inline math.round(x[i]);
|
||||
}
|
||||
} else {
|
||||
out = inline math.round(x);
|
||||
out = #force_inline math.round(x);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
fract :: proc(x: $T) -> T where IS_FLOAT(ELEM_TYPE(T)) {
|
||||
f := inline floor(x);
|
||||
f := #force_inline floor(x);
|
||||
return x - f;
|
||||
}
|
||||
|
||||
mod :: proc(x, m: $T) -> T where IS_FLOAT(ELEM_TYPE(T)) {
|
||||
f := inline floor(x / m);
|
||||
f := #force_inline floor(x / m);
|
||||
return x - f * m;
|
||||
}
|
||||
|
||||
@@ -441,34 +441,34 @@ refract :: proc(I, N: $T) -> (out: T) where IS_ARRAY(T), IS_FLOAT(ELEM_TYPE(T))
|
||||
|
||||
|
||||
is_nan_single :: proc(x: $T) -> bool where IS_FLOAT(T) {
|
||||
return inline math.is_nan(x);
|
||||
return #force_inline math.is_nan(x);
|
||||
}
|
||||
|
||||
is_nan_array :: proc(x: $A/[$N]$T) -> (out: [N]bool) where IS_FLOAT(T) {
|
||||
for i in 0..<N {
|
||||
out[i] = inline is_nan(x[i]);
|
||||
out[i] = #force_inline is_nan(x[i]);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
is_inf_single :: proc(x: $T) -> bool where IS_FLOAT(T) {
|
||||
return inline math.is_inf(x);
|
||||
return #force_inline math.is_inf(x);
|
||||
}
|
||||
|
||||
is_inf_array :: proc(x: $A/[$N]$T) -> (out: [N]bool) where IS_FLOAT(T) {
|
||||
for i in 0..<N {
|
||||
out[i] = inline is_inf(x[i]);
|
||||
out[i] = #force_inline is_inf(x[i]);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
classify_single :: proc(x: $T) -> math.Float_Class where IS_FLOAT(T) {
|
||||
return inline math.classify(x);
|
||||
return #force_inline math.classify(x);
|
||||
}
|
||||
|
||||
classify_array :: proc(x: $A/[$N]$T) -> (out: [N]math.Float_Class) where IS_FLOAT(T) {
|
||||
for i in 0..<N {
|
||||
out[i] = inline classify_single(x[i]);
|
||||
out[i] = #force_inline classify_single(x[i]);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -101,22 +101,22 @@ default_hasher_n :: #force_inline proc "contextless" (data: rawptr, seed: uintpt
|
||||
|
||||
// NOTE(bill): There are loads of predefined ones to improve optimizations for small types
|
||||
|
||||
default_hasher1 :: proc "contextless" (data: rawptr, seed: uintptr) -> uintptr { return inline _default_hasher_const(data, seed, 1); }
|
||||
default_hasher2 :: proc "contextless" (data: rawptr, seed: uintptr) -> uintptr { return inline _default_hasher_const(data, seed, 2); }
|
||||
default_hasher3 :: proc "contextless" (data: rawptr, seed: uintptr) -> uintptr { return inline _default_hasher_const(data, seed, 3); }
|
||||
default_hasher4 :: proc "contextless" (data: rawptr, seed: uintptr) -> uintptr { return inline _default_hasher_const(data, seed, 4); }
|
||||
default_hasher5 :: proc "contextless" (data: rawptr, seed: uintptr) -> uintptr { return inline _default_hasher_const(data, seed, 5); }
|
||||
default_hasher6 :: proc "contextless" (data: rawptr, seed: uintptr) -> uintptr { return inline _default_hasher_const(data, seed, 6); }
|
||||
default_hasher7 :: proc "contextless" (data: rawptr, seed: uintptr) -> uintptr { return inline _default_hasher_const(data, seed, 7); }
|
||||
default_hasher8 :: proc "contextless" (data: rawptr, seed: uintptr) -> uintptr { return inline _default_hasher_const(data, seed, 8); }
|
||||
default_hasher9 :: proc "contextless" (data: rawptr, seed: uintptr) -> uintptr { return inline _default_hasher_const(data, seed, 9); }
|
||||
default_hasher10 :: proc "contextless" (data: rawptr, seed: uintptr) -> uintptr { return inline _default_hasher_const(data, seed, 10); }
|
||||
default_hasher11 :: proc "contextless" (data: rawptr, seed: uintptr) -> uintptr { return inline _default_hasher_const(data, seed, 11); }
|
||||
default_hasher12 :: proc "contextless" (data: rawptr, seed: uintptr) -> uintptr { return inline _default_hasher_const(data, seed, 12); }
|
||||
default_hasher13 :: proc "contextless" (data: rawptr, seed: uintptr) -> uintptr { return inline _default_hasher_const(data, seed, 13); }
|
||||
default_hasher14 :: proc "contextless" (data: rawptr, seed: uintptr) -> uintptr { return inline _default_hasher_const(data, seed, 14); }
|
||||
default_hasher15 :: proc "contextless" (data: rawptr, seed: uintptr) -> uintptr { return inline _default_hasher_const(data, seed, 15); }
|
||||
default_hasher16 :: proc "contextless" (data: rawptr, seed: uintptr) -> uintptr { return inline _default_hasher_const(data, seed, 16); }
|
||||
default_hasher1 :: proc "contextless" (data: rawptr, seed: uintptr) -> uintptr { return #force_inline _default_hasher_const(data, seed, 1); }
|
||||
default_hasher2 :: proc "contextless" (data: rawptr, seed: uintptr) -> uintptr { return #force_inline _default_hasher_const(data, seed, 2); }
|
||||
default_hasher3 :: proc "contextless" (data: rawptr, seed: uintptr) -> uintptr { return #force_inline _default_hasher_const(data, seed, 3); }
|
||||
default_hasher4 :: proc "contextless" (data: rawptr, seed: uintptr) -> uintptr { return #force_inline _default_hasher_const(data, seed, 4); }
|
||||
default_hasher5 :: proc "contextless" (data: rawptr, seed: uintptr) -> uintptr { return #force_inline _default_hasher_const(data, seed, 5); }
|
||||
default_hasher6 :: proc "contextless" (data: rawptr, seed: uintptr) -> uintptr { return #force_inline _default_hasher_const(data, seed, 6); }
|
||||
default_hasher7 :: proc "contextless" (data: rawptr, seed: uintptr) -> uintptr { return #force_inline _default_hasher_const(data, seed, 7); }
|
||||
default_hasher8 :: proc "contextless" (data: rawptr, seed: uintptr) -> uintptr { return #force_inline _default_hasher_const(data, seed, 8); }
|
||||
default_hasher9 :: proc "contextless" (data: rawptr, seed: uintptr) -> uintptr { return #force_inline _default_hasher_const(data, seed, 9); }
|
||||
default_hasher10 :: proc "contextless" (data: rawptr, seed: uintptr) -> uintptr { return #force_inline _default_hasher_const(data, seed, 10); }
|
||||
default_hasher11 :: proc "contextless" (data: rawptr, seed: uintptr) -> uintptr { return #force_inline _default_hasher_const(data, seed, 11); }
|
||||
default_hasher12 :: proc "contextless" (data: rawptr, seed: uintptr) -> uintptr { return #force_inline _default_hasher_const(data, seed, 12); }
|
||||
default_hasher13 :: proc "contextless" (data: rawptr, seed: uintptr) -> uintptr { return #force_inline _default_hasher_const(data, seed, 13); }
|
||||
default_hasher14 :: proc "contextless" (data: rawptr, seed: uintptr) -> uintptr { return #force_inline _default_hasher_const(data, seed, 14); }
|
||||
default_hasher15 :: proc "contextless" (data: rawptr, seed: uintptr) -> uintptr { return #force_inline _default_hasher_const(data, seed, 15); }
|
||||
default_hasher16 :: proc "contextless" (data: rawptr, seed: uintptr) -> uintptr { return #force_inline _default_hasher_const(data, seed, 16); }
|
||||
|
||||
default_hasher_string :: proc "contextless" (data: rawptr, seed: uintptr) -> uintptr {
|
||||
h := u64(seed) + 0xcbf29ce484222325;
|
||||
|
||||
@@ -6,7 +6,7 @@ ptr_add :: proc(p: $P/^$T, x: int) -> ^T {
|
||||
return (^T)(uintptr(p) + size_of(T)*x);
|
||||
}
|
||||
ptr_sub :: proc(p: $P/^$T, x: int) -> ^T {
|
||||
return inline ptr_add(p, -x);
|
||||
return #force_inline ptr_add(p, -x);
|
||||
}
|
||||
|
||||
ptr_swap_non_overlapping :: proc(x, y: rawptr, len: int) {
|
||||
|
||||
Reference in New Issue
Block a user