aboutsummaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2021-08-31 23:47:57 +0100
committergingerBill <bill@gingerbill.org>2021-08-31 23:47:57 +0100
commit720884e0f1d6f15c248f8fbe7b86aa146cedac72 (patch)
tree046cb8ca71dbce74ba3337806f00dabd3c71285b /core
parent773a766b83c327069f3634ad982e29e9e06119e9 (diff)
Strip even more semicolons if followed by a `}` or `)` on the same line
Diffstat (limited to 'core')
-rw-r--r--core/encoding/base64/base64.odin4
-rw-r--r--core/encoding/json/marshal.odin10
-rw-r--r--core/fmt/fmt.odin68
-rw-r--r--core/log/file_console_logger.odin4
-rw-r--r--core/math/big/common.odin2
-rw-r--r--core/math/big/helpers.odin30
-rw-r--r--core/math/big/internal.odin130
-rw-r--r--core/math/big/logical.odin2
-rw-r--r--core/math/big/prime.odin2
-rw-r--r--core/math/big/private.odin10
-rw-r--r--core/math/big/public.odin20
-rw-r--r--core/math/big/radix.odin4
-rw-r--r--core/math/big/test.odin120
-rw-r--r--core/math/bits/bits.odin72
-rw-r--r--core/math/linalg/extended.odin12
-rw-r--r--core/math/linalg/general.odin42
-rw-r--r--core/math/linalg/specific.odin12
-rw-r--r--core/math/math.odin352
-rw-r--r--core/math/rand/rand.odin16
-rw-r--r--core/mem/mem.odin8
-rw-r--r--core/odin/parser/parser.odin26
-rw-r--r--core/os/stat_windows.odin2
-rw-r--r--core/reflect/reflect.odin44
-rw-r--r--core/reflect/types.odin92
-rw-r--r--core/runtime/dynamic_map_internal.odin32
-rw-r--r--core/runtime/internal.odin34
-rw-r--r--core/runtime/print.odin18
-rw-r--r--core/sort/sort.odin8
-rw-r--r--core/strconv/decimal/decimal.odin8
-rw-r--r--core/strconv/strconv.odin8
-rw-r--r--core/strings/strings.odin6
-rw-r--r--core/sync/atomic.odin172
-rw-r--r--core/sys/win32/general.odin10
-rw-r--r--core/text/scanner/scanner.odin6
-rw-r--r--core/unicode/utf16/utf16.odin12
35 files changed, 699 insertions, 699 deletions
diff --git a/core/encoding/base64/base64.odin b/core/encoding/base64/base64.odin
index ca509326b..cf2ea1c12 100644
--- a/core/encoding/base64/base64.odin
+++ b/core/encoding/base64/base64.odin
@@ -53,8 +53,8 @@ encode :: proc(data: []byte, ENC_TBL := ENC_TABLE, allocator := context.allocato
for i, d := 0, 0; i < length; i, d = i + 3, d + 4 {
c0, c1, c2 = int(data[i]), -1, -1
- if i + 1 < length { c1 = int(data[i + 1]); }
- if i + 2 < length { c2 = int(data[i + 2]); }
+ if i + 1 < length { c1 = int(data[i + 1]) }
+ if i + 2 < length { c2 = int(data[i + 2]) }
block = (c0 << 16) | (max(c1, 0) << 8) | max(c2, 0)
diff --git a/core/encoding/json/marshal.odin b/core/encoding/json/marshal.odin
index cea3c3df6..1e23ff0d3 100644
--- a/core/encoding/json/marshal.odin
+++ b/core/encoding/json/marshal.odin
@@ -163,7 +163,7 @@ marshal_arg :: proc(b: ^strings.Builder, v: any) -> Marshal_Error {
case runtime.Type_Info_Array:
strings.write_byte(b, '[')
for i in 0..<info.count {
- if i > 0 { strings.write_string(b, ", "); }
+ if i > 0 { strings.write_string(b, ", ") }
data := uintptr(v.data) + uintptr(i*info.elem_size)
marshal_arg(b, any{rawptr(data), info.elem.id})
@@ -174,7 +174,7 @@ marshal_arg :: proc(b: ^strings.Builder, v: any) -> Marshal_Error {
strings.write_byte(b, '[')
array := cast(^mem.Raw_Dynamic_Array)v.data
for i in 0..<array.len {
- if i > 0 { strings.write_string(b, ", "); }
+ if i > 0 { strings.write_string(b, ", ") }
data := uintptr(array.data) + uintptr(i*info.elem_size)
marshal_arg(b, any{rawptr(data), info.elem.id})
@@ -185,7 +185,7 @@ marshal_arg :: proc(b: ^strings.Builder, v: any) -> Marshal_Error {
strings.write_byte(b, '[')
slice := cast(^mem.Raw_Slice)v.data
for i in 0..<slice.len {
- if i > 0 { strings.write_string(b, ", "); }
+ if i > 0 { strings.write_string(b, ", ") }
data := uintptr(slice.data) + uintptr(i*info.elem_size)
marshal_arg(b, any{rawptr(data), info.elem.id})
@@ -207,7 +207,7 @@ marshal_arg :: proc(b: ^strings.Builder, v: any) -> Marshal_Error {
entry_size := ed.elem_size
for i in 0..<entries.len {
- if i > 0 { strings.write_string(b, ", "); }
+ if i > 0 { strings.write_string(b, ", ") }
data := uintptr(entries.data) + uintptr(i*entry_size)
key := rawptr(data + entry_type.offsets[2])
@@ -223,7 +223,7 @@ marshal_arg :: proc(b: ^strings.Builder, v: any) -> Marshal_Error {
case runtime.Type_Info_Struct:
strings.write_byte(b, '{')
for name, i in info.names {
- if i > 0 { strings.write_string(b, ", "); }
+ if i > 0 { strings.write_string(b, ", ") }
strings.write_quoted_string(b, name)
strings.write_string(b, ": ")
diff --git a/core/fmt/fmt.odin b/core/fmt/fmt.odin
index 8c667390f..ca51be3b6 100644
--- a/core/fmt/fmt.odin
+++ b/core/fmt/fmt.odin
@@ -85,13 +85,13 @@ fprint_typeid :: proc(fd: os.Handle, id: typeid) -> int {
}
// print* procedures return the number of bytes written
-print :: proc(args: ..any, sep := " ") -> int { return fprint(fd=os.stdout, args=args, sep=sep); }
-println :: proc(args: ..any, sep := " ") -> int { return fprintln(fd=os.stdout, args=args, sep=sep); }
-printf :: proc(fmt: string, args: ..any) -> int { return fprintf(os.stdout, fmt, ..args); }
+print :: proc(args: ..any, sep := " ") -> int { return fprint(fd=os.stdout, args=args, sep=sep) }
+println :: proc(args: ..any, sep := " ") -> int { return fprintln(fd=os.stdout, args=args, sep=sep) }
+printf :: proc(fmt: string, args: ..any) -> int { return fprintf(os.stdout, fmt, ..args) }
-eprint :: proc(args: ..any, sep := " ") -> int { return fprint(fd=os.stderr, args=args, sep=sep); }
-eprintln :: proc(args: ..any, sep := " ") -> int { return fprintln(fd=os.stderr, args=args, sep=sep); }
-eprintf :: proc(fmt: string, args: ..any) -> int { return fprintf(os.stderr, fmt, ..args); }
+eprint :: proc(args: ..any, sep := " ") -> int { return fprint(fd=os.stderr, args=args, sep=sep) }
+eprintln :: proc(args: ..any, sep := " ") -> int { return fprintln(fd=os.stderr, args=args, sep=sep) }
+eprintf :: proc(fmt: string, args: ..any) -> int { return fprintf(os.stderr, fmt, ..args) }
// aprint* procedures return a string that was allocated with the current context
@@ -688,9 +688,9 @@ _fmt_int :: proc(fi: ^Info, u: u64, base: int, is_signed: bool, bit_size: int, d
start := 0
flags: strconv.Int_Flags
- if fi.hash && !fi.zero { flags |= {.Prefix}; }
- if fi.plus { flags |= {.Plus}; }
- if fi.space { flags |= {.Space}; }
+ if fi.hash && !fi.zero { flags |= {.Prefix} }
+ if fi.plus { flags |= {.Plus} }
+ if fi.space { flags |= {.Space} }
s := strconv.append_bits(buf[start:], u, base, is_signed, bit_size, digits, flags)
if fi.hash && fi.zero && fi.indent == 0 {
@@ -754,9 +754,9 @@ _fmt_int_128 :: proc(fi: ^Info, u: u128, base: int, is_signed: bool, bit_size: i
start := 0
flags: strconv.Int_Flags
- if fi.hash && !fi.zero { flags |= {.Prefix}; }
- if fi.plus { flags |= {.Plus}; }
- if fi.space { flags |= {.Space}; }
+ if fi.hash && !fi.zero { flags |= {.Prefix} }
+ if fi.plus { flags |= {.Plus} }
+ if fi.space { flags |= {.Space} }
s := strconv.append_bits_128(buf[start:], u, base, is_signed, bit_size, digits, flags)
if fi.hash && fi.zero && fi.indent == 0 {
@@ -1154,19 +1154,19 @@ fmt_bit_set :: proc(fi: ^Info, v: any, name: string = "") {
bits = u128(x)
case 16:
x := (^u16)(v.data)^
- if do_byte_swap { x = byte_swap(x); }
+ if do_byte_swap { x = byte_swap(x) }
bits = u128(x)
case 32:
x := (^u32)(v.data)^
- if do_byte_swap { x = byte_swap(x); }
+ if do_byte_swap { x = byte_swap(x) }
bits = u128(x)
case 64:
x := (^u64)(v.data)^
- if do_byte_swap { x = byte_swap(x); }
+ if do_byte_swap { x = byte_swap(x) }
bits = u128(x)
case 128:
x := (^u128)(v.data)^
- if do_byte_swap { x = byte_swap(x); }
+ if do_byte_swap { x = byte_swap(x) }
bits = x
case: panic("unknown bit_size size")
}
@@ -1237,7 +1237,7 @@ fmt_write_array :: proc(fi: ^Info, array_data: rawptr, count: int, elem_size: in
}
} else {
for i in 0..<count {
- if i > 0 { io.write_string(fi.writer, ", "); }
+ if i > 0 { io.write_string(fi.writer, ", ") }
data := uintptr(array_data) + uintptr(i*elem_size)
fmt_arg(fi, any{rawptr(data), elem_id}, verb)
@@ -1437,7 +1437,7 @@ fmt_value :: proc(fi: ^Info, v: any, verb: rune) {
}
defer {
if hash {
- for in 0..<indent { io.write_byte(fi.writer, '\t'); }
+ for in 0..<indent { io.write_byte(fi.writer, '\t') }
}
io.write_byte(fi.writer, ']' if is_soa else '}')
}
@@ -1452,11 +1452,11 @@ fmt_value :: proc(fi: ^Info, v: any, verb: rune) {
}
for index in 0..<uintptr(b.soa_len) {
- if !hash && index > 0 { io.write_string(fi.writer, ", "); }
+ if !hash && index > 0 { io.write_string(fi.writer, ", ") }
field_count := -1
- if !hash && field_count > 0 { io.write_string(fi.writer, ", "); }
+ if !hash && field_count > 0 { io.write_string(fi.writer, ", ") }
io.write_string(fi.writer, base_type_name)
io.write_byte(fi.writer, '{')
@@ -1465,7 +1465,7 @@ fmt_value :: proc(fi: ^Info, v: any, verb: rune) {
for name, i in b.names {
field_count += 1
- if !hash && field_count > 0 { io.write_string(fi.writer, ", "); }
+ if !hash && field_count > 0 { io.write_string(fi.writer, ", ") }
if hash {
fmt_write_indent(fi)
}
@@ -1482,7 +1482,7 @@ fmt_value :: proc(fi: ^Info, v: any, verb: rune) {
fmt_arg(fi, any{data, t.id}, 'v')
}
- if hash { io.write_string(fi.writer, ",\n"); }
+ if hash { io.write_string(fi.writer, ",\n") }
}
}
} else {
@@ -1490,7 +1490,7 @@ fmt_value :: proc(fi: ^Info, v: any, verb: rune) {
for name, i in b.names {
field_count += 1
- if !hash && field_count > 0 { io.write_string(fi.writer, ", "); }
+ if !hash && field_count > 0 { io.write_string(fi.writer, ", ") }
if hash {
fmt_write_indent(fi)
}
@@ -1505,7 +1505,7 @@ fmt_value :: proc(fi: ^Info, v: any, verb: rune) {
fmt_arg(fi, any{data, t.id}, 'v')
}
- if hash { io.write_string(fi.writer, ",\n"); }
+ if hash { io.write_string(fi.writer, ",\n") }
}
}
@@ -1652,7 +1652,7 @@ fmt_value :: proc(fi: ^Info, v: any, verb: rune) {
io.write_byte(fi.writer, '[')
defer io.write_byte(fi.writer, ']')
for i in 0..<info.count {
- if i > 0 { io.write_string(fi.writer, ", "); }
+ if i > 0 { io.write_string(fi.writer, ", ") }
idx, ok := stored_enum_value_to_string(info.index, info.min_value, i)
if ok {
@@ -1683,7 +1683,7 @@ fmt_value :: proc(fi: ^Info, v: any, verb: rune) {
io.write_byte(fi.writer, '<')
defer io.write_byte(fi.writer, '>')
for i in 0..<info.count {
- if i > 0 { io.write_string(fi.writer, ", "); }
+ if i > 0 { io.write_string(fi.writer, ", ") }
data := uintptr(v.data) + uintptr(i*info.elem_size)
fmt_arg(fi, any{rawptr(data), info.elem.id}, verb)
@@ -1721,7 +1721,7 @@ fmt_value :: proc(fi: ^Info, v: any, verb: rune) {
entry_size := ed.elem_size
for i in 0..<entries.len {
- if i > 0 { io.write_string(fi.writer, ", "); }
+ if i > 0 { io.write_string(fi.writer, ", ") }
data := uintptr(entries.data) + uintptr(i*entry_size)
@@ -1751,7 +1751,7 @@ fmt_value :: proc(fi: ^Info, v: any, verb: rune) {
// fi.hash = false;
- if hash { io.write_byte(fi.writer, '\n'); }
+ if hash { io.write_byte(fi.writer, '\n') }
if is_soa {
fi.indent += 1
@@ -1780,11 +1780,11 @@ fmt_value :: proc(fi: ^Info, v: any, verb: rune) {
for index in 0..<n {
- if !hash && index > 0 { io.write_string(fi.writer, ", "); }
+ if !hash && index > 0 { io.write_string(fi.writer, ", ") }
field_count := -1
- if !hash && field_count > 0 { io.write_string(fi.writer, ", "); }
+ if !hash && field_count > 0 { io.write_string(fi.writer, ", ") }
io.write_string(fi.writer, base_type_name)
io.write_byte(fi.writer, '{')
@@ -1794,7 +1794,7 @@ fmt_value :: proc(fi: ^Info, v: any, verb: rune) {
name := info.names[i]
field_count += 1
- if !hash && field_count > 0 { io.write_string(fi.writer, ", "); }
+ if !hash && field_count > 0 { io.write_string(fi.writer, ", ") }
if hash {
fmt_write_indent(fi)
}
@@ -1823,7 +1823,7 @@ fmt_value :: proc(fi: ^Info, v: any, verb: rune) {
}
}
- if hash { io.write_string(fi.writer, ",\n"); }
+ if hash { io.write_string(fi.writer, ",\n") }
}
}
} else {
@@ -1831,7 +1831,7 @@ fmt_value :: proc(fi: ^Info, v: any, verb: rune) {
for name, i in info.names {
field_count += 1
- if !hash && field_count > 0 { io.write_string(fi.writer, ", "); }
+ if !hash && field_count > 0 { io.write_string(fi.writer, ", ") }
if hash {
fmt_write_indent(fi)
}
@@ -1942,7 +1942,7 @@ fmt_value :: proc(fi: ^Info, v: any, verb: rune) {
defer io.write_byte(fi.writer, ']')
for i in 0..<len {
- if i > 0 { io.write_string(fi.writer, ", "); }
+ if i > 0 { io.write_string(fi.writer, ", ") }
data := uintptr(ptr) + uintptr(i*slice_type.elem_size)
fmt_arg(fi, any{rawptr(data), slice_type.elem.id}, verb)
diff --git a/core/log/file_console_logger.odin b/core/log/file_console_logger.odin
index a3070cd0b..cc019617f 100644
--- a/core/log/file_console_logger.odin
+++ b/core/log/file_console_logger.odin
@@ -77,8 +77,8 @@ file_console_logger_proc :: proc(logger_data: rawptr, level: Level, text: string
t := time.now()
y, m, d := time.date(t)
h, min, s := time.clock(t)
- if .Date in options { fmt.sbprintf(&buf, "%d-%02d-%02d ", y, m, d); }
- if .Time in options { fmt.sbprintf(&buf, "%02d:%02d:%02d", h, min, s); }
+ if .Date in options { fmt.sbprintf(&buf, "%d-%02d-%02d ", y, m, d) }
+ if .Time in options { fmt.sbprintf(&buf, "%02d:%02d:%02d", h, min, s) }
fmt.sbprint(&buf, "] ")
}
}
diff --git a/core/math/big/common.odin b/core/math/big/common.odin
index 643e8b49d..c43346f5a 100644
--- a/core/math/big/common.odin
+++ b/core/math/big/common.odin
@@ -87,7 +87,7 @@ FACTORIAL_BINARY_SPLIT_MAX_RECURSIONS := 100
*/
MATH_BIG_FORCE_64_BIT :: #config(MATH_BIG_FORCE_64_BIT, false)
MATH_BIG_FORCE_32_BIT :: #config(MATH_BIG_FORCE_32_BIT, false)
-when (MATH_BIG_FORCE_32_BIT && MATH_BIG_FORCE_64_BIT) { #panic("Cannot force 32-bit and 64-bit big backend simultaneously."); }
+when (MATH_BIG_FORCE_32_BIT && MATH_BIG_FORCE_64_BIT) { #panic("Cannot force 32-bit and 64-bit big backend simultaneously.") }
_LOW_MEMORY :: #config(BIGINT_SMALL_MEMORY, false)
when _LOW_MEMORY {
diff --git a/core/math/big/helpers.odin b/core/math/big/helpers.odin
index 6b01fc241..45c6771da 100644
--- a/core/math/big/helpers.odin
+++ b/core/math/big/helpers.odin
@@ -56,7 +56,7 @@ int_copy :: proc(dest, src: ^Int, minimize := false, allocator := context.alloca
/*
If dest == src, do nothing
*/
- if (dest == src) { return nil; }
+ if (dest == src) { return nil }
/*
Check that `src` is usable and `dest` isn't immutable.
@@ -383,7 +383,7 @@ assert_initialized :: proc(a: ^Int, loc := #caller_location) {
zero_unused :: proc(dest: ^Int, old_used := -1) {
assert_if_nil(dest)
- if ! #force_inline is_initialized(dest) { return; }
+ if ! #force_inline is_initialized(dest) { return }
#force_inline internal_zero_unused(dest, old_used)
}
@@ -405,13 +405,13 @@ clear_if_uninitialized_multi :: proc(args: ..^Int, allocator := context.allocato
clear_if_uninitialized :: proc {clear_if_uninitialized_single, clear_if_uninitialized_multi, }
error_if_immutable_single :: proc(arg: ^Int) -> (err: Error) {
- if arg != nil && .Immutable in arg.flags { return .Assignment_To_Immutable; }
+ if arg != nil && .Immutable in arg.flags { return .Assignment_To_Immutable }
return nil
}
error_if_immutable_multi :: proc(args: ..^Int) -> (err: Error) {
for i in args {
- if i != nil && .Immutable in i.flags { return .Assignment_To_Immutable; }
+ if i != nil && .Immutable in i.flags { return .Assignment_To_Immutable }
}
return nil
}
@@ -489,7 +489,7 @@ int_to_bytes_little :: proc(a: ^Int, buf: []u8, signed := false, allocator := co
size_in_bytes := int_to_bytes_size(a, signed, allocator) or_return
l := len(buf)
- if size_in_bytes > l { return .Buffer_Overflow; }
+ if size_in_bytes > l { return .Buffer_Overflow }
size_in_bits := internal_count_bits(a)
i := 0
@@ -512,7 +512,7 @@ int_to_bytes_big :: proc(a: ^Int, buf: []u8, signed := false, allocator := conte
size_in_bytes := int_to_bytes_size(a, signed, allocator) or_return
l := len(buf)
- if size_in_bytes > l { return .Buffer_Overflow; }
+ if size_in_bytes > l { return .Buffer_Overflow }
size_in_bits := internal_count_bits(a)
i := l - 1
@@ -534,11 +534,11 @@ int_to_bytes_big :: proc(a: ^Int, buf: []u8, signed := false, allocator := conte
int_to_bytes_little_python :: proc(a: ^Int, buf: []u8, signed := false, allocator := context.allocator) -> (err: Error) {
assert_if_nil(a)
- if !signed && a.sign == .Negative { return .Invalid_Argument; }
+ if !signed && a.sign == .Negative { return .Invalid_Argument }
l := len(buf)
size_in_bytes := int_to_bytes_size(a, signed, allocator) or_return
- if size_in_bytes > l { return .Buffer_Overflow; }
+ if size_in_bytes > l { return .Buffer_Overflow }
if a.sign == .Negative {
t := &Int{}
@@ -570,12 +570,12 @@ int_to_bytes_little_python :: proc(a: ^Int, buf: []u8, signed := false, allocato
int_to_bytes_big_python :: proc(a: ^Int, buf: []u8, signed := false, allocator := context.allocator) -> (err: Error) {
assert_if_nil(a)
- if !signed && a.sign == .Negative { return .Invalid_Argument; }
- if a.sign == .Zero_or_Positive { return int_to_bytes_big(a, buf, signed, allocator); }
+ if !signed && a.sign == .Negative { return .Invalid_Argument }
+ if a.sign == .Zero_or_Positive { return int_to_bytes_big(a, buf, signed, allocator) }
l := len(buf)
size_in_bytes := int_to_bytes_size(a, signed, allocator) or_return
- if size_in_bytes > l { return .Buffer_Overflow; }
+ if size_in_bytes > l { return .Buffer_Overflow }
t := &Int{}
defer destroy(t)
@@ -601,7 +601,7 @@ int_from_bytes_big :: proc(a: ^Int, buf: []u8, signed := false, allocator := con
assert_if_nil(a)
buf := buf
l := len(buf)
- if l == 0 { return .Invalid_Argument; }
+ if l == 0 { return .Invalid_Argument }
sign: Sign
size_in_bits := l * 8
@@ -638,7 +638,7 @@ int_from_bytes_big_python :: proc(a: ^Int, buf: []u8, signed := false, allocator
assert_if_nil(a)
buf := buf
l := len(buf)
- if l == 0 { return .Invalid_Argument; }
+ if l == 0 { return .Invalid_Argument }
sign: Sign
size_in_bits := l * 8
@@ -684,7 +684,7 @@ int_from_bytes_little :: proc(a: ^Int, buf: []u8, signed := false, allocator :=
assert_if_nil(a)
buf := buf
l := len(buf)
- if l == 0 { return .Invalid_Argument; }
+ if l == 0 { return .Invalid_Argument }
sign: Sign
size_in_bits := l * 8
@@ -722,7 +722,7 @@ int_from_bytes_little_python :: proc(a: ^Int, buf: []u8, signed := false, alloca
assert_if_nil(a)
buf := buf
l := len(buf)
- if l == 0 { return .Invalid_Argument; }
+ if l == 0 { return .Invalid_Argument }
sign: Sign
size_in_bits := l * 8
diff --git a/core/math/big/internal.odin b/core/math/big/internal.odin
index b0e0c1f5d..63c702f5e 100644
--- a/core/math/big/internal.odin
+++ b/core/math/big/internal.odin
@@ -628,7 +628,7 @@ internal_int_mul :: proc(dest, src, multiplier: ^Int, allocator := context.alloc
/*
Early out for `multiplier` is zero; Set `dest` to zero.
*/
- if multiplier.used == 0 || src.used == 0 { return internal_zero(dest); }
+ if multiplier.used == 0 || src.used == 0 { return internal_zero(dest) }
neg := src.sign != multiplier.sign
@@ -715,7 +715,7 @@ internal_sqr :: proc (dest, src: ^Int, allocator := context.allocator) -> (res:
*/
internal_int_divmod :: proc(quotient, remainder, numerator, denominator: ^Int, allocator := context.allocator) -> (err: Error) {
context.allocator = allocator
- if denominator.used == 0 { return .Division_by_Zero; }
+ if denominator.used == 0 { return .Division_by_Zero }
/*
If numerator < denominator then quotient = 0, remainder = numerator.
*/
@@ -757,7 +757,7 @@ internal_int_divmod_digit :: proc(quotient, numerator: ^Int, denominator: DIGIT,
/*
Cannot divide by zero.
*/
- if denominator == 0 { return 0, .Division_by_Zero; }
+ if denominator == 0 { return 0, .Division_by_Zero }
/*
Quick outs.
@@ -854,7 +854,7 @@ internal_div :: proc { internal_int_div, }
internal_int_mod :: proc(remainder, numerator, denominator: ^Int, allocator := context.allocator) -> (err: Error) {
#force_inline internal_int_divmod(nil, remainder, numerator, denominator, allocator) or_return
- if remainder.used == 0 || denominator.sign == remainder.sign { return nil; }
+ if remainder.used == 0 || denominator.sign == remainder.sign { return nil }
return #force_inline internal_add(remainder, remainder, numerator, allocator)
}
@@ -937,7 +937,7 @@ internal_int_factorial :: proc(res: ^Int, n: int, allocator := context.allocator
`res_gcd` and `res_lcm` can be nil or ^Int depending on which results are desired.
*/
internal_int_gcd_lcm :: proc(res_gcd, res_lcm, a, b: ^Int, allocator := context.allocator) -> (err: Error) {
- if res_gcd == nil && res_lcm == nil { return nil; }
+ if res_gcd == nil && res_lcm == nil { return nil }
return #force_inline _private_int_gcd_lcm(res_gcd, res_lcm, a, b, allocator)
}
@@ -951,7 +951,7 @@ internal_int_mod_bits :: proc(remainder, numerator: ^Int, bits: int, allocator :
/*
Everything is divisible by 1 << 0 == 1, so this returns 0.
*/
- if bits == 0 { return internal_zero(remainder); }
+ if bits == 0 { return internal_zero(remainder) }
/*
If the modulus is larger than the value, return the value.
@@ -1034,7 +1034,7 @@ internal_is_negative :: proc { internal_int_is_negative, }
Assumes `a` not to be `nil`.
*/
internal_int_is_even :: #force_inline proc(a: ^Int) -> (even: bool) {
- if internal_is_zero(a) { return true; }
+ if internal_is_zero(a) { return true }
/*
`a.used` > 0 here, because the above handled `is_zero`.
@@ -1062,23 +1062,23 @@ internal_int_is_power_of_two :: #force_inline proc(a: ^Int) -> (power_of_two: bo
/*
Early out for Int == 0.
*/
- if #force_inline internal_is_zero(a) { return true; }
+ if #force_inline internal_is_zero(a) { return true }
/*
For an `Int` to be a power of two, its bottom limb has to be a power of two.
*/
- if ! #force_inline platform_int_is_power_of_two(int(a.digit[a.used - 1])) { return false; }
+ if ! #force_inline platform_int_is_power_of_two(int(a.digit[a.used - 1])) { return false }
/*
We've established that the bottom limb is a power of two.
If it's the only limb, that makes the entire Int a power of two.
*/
- if a.used == 1 { return true; }
+ if a.used == 1 { return true }
/*
For an `Int` to be a power of two, all limbs except the top one have to be zero.
*/
- for i := 1; i < a.used && a.digit[i - 1] != 0; i += 1 { return false; }
+ for i := 1; i < a.used && a.digit[i - 1] != 0; i += 1 { return false }
return true
}
@@ -1096,11 +1096,11 @@ internal_int_compare :: #force_inline proc(a, b: ^Int) -> (comparison: int) {
/*
Compare based on sign.
*/
- if a.sign != b.sign { return -1 if a_is_negative else +1; }
+ if a.sign != b.sign { return -1 if a_is_negative else +1 }
/*
If `a` is negative, compare in the opposite direction */
- if a_is_negative { return #force_inline internal_compare_magnitude(b, a); }
+ if a_is_negative { return #force_inline internal_compare_magnitude(b, a) }
return #force_inline internal_compare_magnitude(a, b)
}
@@ -1186,20 +1186,20 @@ internal_int_is_square :: proc(a: ^Int, allocator := context.allocator) -> (squa
*/
square = false
- if internal_is_negative(a) { return; }
- if internal_is_zero(a) { return; }
+ if internal_is_negative(a) { return }
+ if internal_is_zero(a) { return }
/*
First check mod 128 (suppose that _DIGIT_BITS is at least 7).
*/
- if _private_int_rem_128[127 & a.digit[0]] == 1 { return; }
+ if _private_int_rem_128[127 & a.digit[0]] == 1 { return }
/*
Next check mod 105 (3*5*7).
*/
c: DIGIT
c, err = internal_mod(a, 105)
- if _private_int_rem_105[c] == 1 { return; }
+ if _private_int_rem_105[c] == 1 { return }
t := &Int{}
defer destroy(t)
@@ -1215,13 +1215,13 @@ internal_int_is_square :: proc(a: ^Int, allocator := context.allocator) -> (squa
free "t" so the easiest way is to goto LBL_ERR. We know that err
is already equal to MP_OKAY from the mp_mod call
*/
- if (1 << (r % 11) & 0x5C4) != 0 { return; }
- if (1 << (r % 13) & 0x9E4) != 0 { return; }
- if (1 << (r % 17) & 0x5CE8) != 0 { return; }
- if (1 << (r % 19) & 0x4F50C) != 0 { return; }
- if (1 << (r % 23) & 0x7ACCA0) != 0 { return; }
- if (1 << (r % 29) & 0xC2EDD0C) != 0 { return; }
- if (1 << (r % 31) & 0x6DE2B848) != 0 { return; }
+ if (1 << (r % 11) & 0x5C4) != 0 { return }
+ if (1 << (r % 13) & 0x9E4) != 0 { return }
+ if (1 << (r % 17) & 0x5CE8) != 0 { return }
+ if (1 << (r % 19) & 0x4F50C) != 0 { return }
+ if (1 << (r % 23) & 0x7ACCA0) != 0 { return }
+ if (1 << (r % 29) & 0xC2EDD0C) != 0 { return }
+ if (1 << (r % 31) & 0x6DE2B848) != 0 { return }
/*
Final check - is sqr(sqrt(arg)) == arg?
@@ -1243,20 +1243,20 @@ internal_int_is_square :: proc(a: ^Int, allocator := context.allocator) -> (squa
Assumes `a` to not be `nil` and have been iniialized.
*/
internal_int_log :: proc(a: ^Int, base: DIGIT) -> (res: int, err: Error) {
- if base < 2 || DIGIT(base) > _DIGIT_MAX { return -1, .Invalid_Argument; }
+ if base < 2 || DIGIT(base) > _DIGIT_MAX { return -1, .Invalid_Argument }
- if internal_is_negative(a) { return -1, .Math_Domain_Error; }
- if internal_is_zero(a) { return -1, .Math_Domain_Error; }
+ if internal_is_negative(a) { return -1, .Math_Domain_Error }
+ if internal_is_zero(a) { return -1, .Math_Domain_Error }
/*
Fast path for bases that are a power of two.
*/
- if platform_int_is_power_of_two(int(base)) { return _private_log_power_of_two(a, base); }
+ if platform_int_is_power_of_two(int(base)) { return _private_log_power_of_two(a, base) }
/*
Fast path for `Int`s that fit within a single `DIGIT`.
*/
- if a.used == 1 { return internal_log(a.digit[0], DIGIT(base)); }
+ if a.used == 1 { return internal_log(a.digit[0], DIGIT(base)) }
return _private_int_log(a, base)
@@ -1270,12 +1270,12 @@ internal_digit_log :: proc(a: DIGIT, base: DIGIT) -> (log: int, err: Error) {
If the number is smaller than the base, it fits within a fraction.
Therefore, we return 0.
*/
- if a < base { return 0, nil; }
+ if a < base { return 0, nil }
/*
If a number equals the base, the log is 1.
*/
- if a == base { return 1, nil; }
+ if a == base { return 1, nil }
N := _WORD(a)
bracket_low := _WORD(1)
@@ -1334,8 +1334,8 @@ internal_int_pow :: proc(dest, base: ^Int, power: int, allocator := context.allo
internal_zero(dest) or_return
return .Math_Domain_Error
}
- if power == 0 { return internal_one(dest); }
- if power > 0 { return internal_zero(dest); }
+ if power == 0 { return internal_one(dest) }
+ if power > 0 { return internal_zero(dest) }
}
if power < 0 {
@@ -1435,12 +1435,12 @@ internal_int_sqrt :: proc(dest, src: ^Int, allocator := context.allocator) -> (e
/*
Must be positive.
*/
- if #force_inline internal_is_negative(src) { return .Invalid_Argument; }
+ if #force_inline internal_is_negative(src) { return .Invalid_Argument }
/*
Easy out. If src is zero, so is dest.
*/
- if #force_inline internal_is_zero(src) { return internal_zero(dest); }
+ if #force_inline internal_is_zero(src) { return internal_zero(dest) }
/*
Set up temporaries.
@@ -1489,11 +1489,11 @@ internal_int_root_n :: proc(dest, src: ^Int, n: int, allocator := context.alloca
/*
Fast path for n == 2
*/
- if n == 2 { return #force_inline internal_sqrt(dest, src); }
+ if n == 2 { return #force_inline internal_sqrt(dest, src) }
- if n < 0 || n > int(_DIGIT_MAX) { return .Invalid_Argument; }
+ if n < 0 || n > int(_DIGIT_MAX) { return .Invalid_Argument }
- if n & 1 == 0 && #force_inline internal_is_negative(src) { return .Invalid_Argument; }
+ if n & 1 == 0 && #force_inline internal_is_negative(src) { return .Invalid_Argument }
/*
Set up temporaries.
@@ -1576,8 +1576,8 @@ internal_int_root_n :: proc(dest, src: ^Int, n: int, allocator := context.alloca
Number of rounds is at most log_2(root). If it is more it
got stuck, so break out of the loop and do the rest manually.
*/
- if ilog2 -= 1; ilog2 == 0 { break; }
- if internal_cmp(t1, t2) == 0 { break; }
+ if ilog2 -= 1; ilog2 == 0 { break }
+ if internal_cmp(t1, t2) == 0 { break }
iterations += 1
if iterations == MAX_ITERATIONS_ROOT_N {
@@ -1615,7 +1615,7 @@ internal_int_root_n :: proc(dest, src: ^Int, n: int, allocator := context.alloca
for {
internal_pow(t2, t1, n) or_return
- if internal_cmp(t2, a) != 1 { break; }
+ if internal_cmp(t2, a) != 1 { break }
internal_sub(t1, t1, DIGIT(1)) or_return
@@ -1712,7 +1712,7 @@ internal_int_copy :: proc(dest, src: ^Int, minimize := false, allocator := conte
/*
If dest == src, do nothing
*/
- if (dest == src) { return nil; }
+ if (dest == src) { return nil }
internal_error_if_immutable(dest) or_return
@@ -1821,17 +1821,17 @@ internal_int_inverse_modulo :: proc(dest, a, b: ^Int, allocator := context.alloc
/*
For all n in N and n > 0, n = 0 mod 1.
*/
- if internal_is_positive(a) && internal_cmp(b, 1) == 0 { return internal_zero(dest); }
+ if internal_is_positive(a) && internal_cmp(b, 1) == 0 { return internal_zero(dest) }
/*
`b` cannot be negative and has to be > 1
*/
- if internal_is_negative(b) && internal_cmp(b, 1) != 1 { return .Invalid_Argument; }
+ if internal_is_negative(b) && internal_cmp(b, 1) != 1 { return .Invalid_Argument }
/*
If the modulus is odd we can use a faster routine instead.
*/
- if internal_is_odd(b) { return _private_inverse_modulo_odd(dest, a, b); }
+ if internal_is_odd(b) { return _private_inverse_modulo_odd(dest, a, b) }
return _private_inverse_modulo(dest, a, b)
}
@@ -1850,12 +1850,12 @@ internal_int_bitfield_extract :: proc(a: ^Int, offset, count: int) -> (res: _WOR
*/
if count == 1 {
limb := offset / _DIGIT_BITS
- if limb < 0 || limb >= a.used { return 0, .Invalid_Argument; }
+ if limb < 0 || limb >= a.used { return 0, .Invalid_Argument }
i := _WORD(1 << _WORD((offset % _DIGIT_BITS)))
return 1 if ((_WORD(a.digit[limb]) & i) != 0) else 0, nil
}
- if count > _WORD_BITS || count < 1 { return 0, .Invalid_Argument; }
+ if count > _WORD_BITS || count < 1 { return 0, .Invalid_Argument }
/*
There are 3 possible cases.
@@ -1880,7 +1880,7 @@ internal_int_bitfield_extract :: proc(a: ^Int, offset, count: int) -> (res: _WOR
res = (_WORD(a.digit[limb]) >> uint(shift)) & mask
bits_left -= num_bits
- if bits_left == 0 { return res, nil; }
+ if bits_left == 0 { return res, nil }
res_shift := num_bits
num_bits = min(bits_left, _DIGIT_BITS)
@@ -1889,7 +1889,7 @@ internal_int_bitfield_extract :: proc(a: ^Int, offset, count: int) -> (res: _WOR
res |= (_WORD(a.digit[limb + 1]) & mask) << uint(res_shift)
bits_left -= num_bits
- if bits_left == 0 { return res, nil; }
+ if bits_left == 0 { return res, nil }
mask = (1 << uint(bits_left)) - 1
res_shift += _DIGIT_BITS
@@ -1908,7 +1908,7 @@ internal_int_bitfield_extract :: proc(a: ^Int, offset, count: int) -> (res: _WOR
internal_int_shrink :: proc(a: ^Int) -> (err: Error) {
needed := max(_MIN_DIGIT_COUNT, a.used)
- if a.used != needed { return internal_grow(a, needed, true); }
+ if a.used != needed { return internal_grow(a, needed, true) }
return nil
}
internal_shrink :: proc { internal_int_shrink, }
@@ -2006,7 +2006,7 @@ internal_nan :: proc { internal_int_nan, }
internal_int_power_of_two :: proc(a: ^Int, power: int, allocator := context.allocator) -> (err: Error) {
context.allocator = allocator
- if power < 0 || power > _MAX_BIT_COUNT { return .Invalid_Argument; }
+ if power < 0 || power > _MAX_BIT_COUNT { return .Invalid_Argument }
/*
Grow to accomodate the single bit.
@@ -2080,7 +2080,7 @@ internal_int_get :: proc(a: ^Int, $T: typeid) -> (res: T, err: Error) where intr
/*
Set the sign.
*/
- if a.sign == .Negative { res = -res; }
+ if a.sign == .Negative { res = -res }
}
return
}
@@ -2326,7 +2326,7 @@ internal_int_shrmod :: proc(quotient, remainder, numerator: ^Int, bits: int, all
context.allocator = allocator
bits := bits
- if bits < 0 { return .Invalid_Argument; }
+ if bits < 0 { return .Invalid_Argument }
internal_copy(quotient, numerator) or_return
@@ -2387,12 +2387,12 @@ internal_shr :: proc { internal_int_shr, }
internal_int_shr_digit :: proc(quotient: ^Int, digits: int, allocator := context.allocator) -> (err: Error) {
context.allocator = allocator
- if digits <= 0 { return nil; }
+ if digits <= 0 { return nil }
/*
If digits > used simply zero and return.
*/
- if digits > quotient.used { return internal_zero(quotient); }
+ if digits > quotient.used { return internal_zero(quotient) }
/*
Much like `int_shl_digit`, this is implemented using a sliding window,
@@ -2436,7 +2436,7 @@ internal_int_shl :: proc(dest, src: ^Int, bits: int, allocator := context.alloca
bits := bits
- if bits < 0 { return .Invalid_Argument; }
+ if bits < 0 { return .Invalid_Argument }
internal_copy(dest, src) or_return
@@ -2487,7 +2487,7 @@ internal_shl :: proc { internal_int_shl, }
internal_int_shl_digit :: proc(quotient: ^Int, digits: int, allocator := context.allocator) -> (err: Error) {
context.allocator = allocator
- if digits <= 0 { return nil; }
+ if digits <= 0 { return nil }
/*
No need to shift a zero.
@@ -2527,7 +2527,7 @@ internal_count_bits :: proc(a: ^Int) -> (count: int) {
/*
Fast path for zero.
*/
- if #force_inline internal_is_zero(a) { return {}; }
+ if #force_inline internal_is_zero(a) { return {} }
/*
Get the number of DIGITs and use it.
*/
@@ -2550,7 +2550,7 @@ internal_int_count_lsb :: proc(a: ^Int) -> (count: int, err: Error) {
/*
Easy out.
*/
- if #force_inline internal_is_zero(a) { return {}, nil; }
+ if #force_inline internal_is_zero(a) { return {}, nil }
/*
Scan lower digits until non-zero.
@@ -2588,7 +2588,7 @@ internal_int_rand :: proc(dest: ^Int, bits: int, r: ^rnd.Rand = nil, allocator :
bits := bits
- if bits <= 0 { return .Invalid_Argument; }
+ if bits <= 0 { return .Invalid_Argument }
digits := bits / _DIGIT_BITS
bits %= _DIGIT_BITS
@@ -2632,7 +2632,7 @@ internal_clear_if_uninitialized_multi :: proc(args: ..^Int, allocator := context
for i in args {
if ! #force_inline internal_is_initialized(i) {
e := #force_inline internal_grow(i, _DEFAULT_DIGIT_COUNT)
- if e != nil { err = e; }
+ if e != nil { err = e }
}
}
return err
@@ -2640,13 +2640,13 @@ internal_clear_if_uninitialized_multi :: proc(args: ..^Int, allocator := context
internal_clear_if_uninitialized :: proc {internal_clear_if_uninitialized_single, internal_clear_if_uninitialized_multi, }
internal_error_if_immutable_single :: proc(arg: ^Int) -> (err: Error) {
- if arg != nil && .Immutable in arg.flags { return .Assignment_To_Immutable; }
+ if arg != nil && .Immutable in arg.flags { return .Assignment_To_Immutable }
return nil
}
internal_error_if_immutable_multi :: proc(args: ..^Int) -> (err: Error) {
for i in args {
- if i != nil && .Immutable in i.flags { return .Assignment_To_Immutable; }
+ if i != nil && .Immutable in i.flags { return .Assignment_To_Immutable }
}
return nil
}
@@ -2674,9 +2674,9 @@ internal_init_multi :: proc { internal_int_init_multi, }
Typically very fast. Also fixes the sign if there are no more leading digits.
*/
internal_clamp :: proc(a: ^Int) -> (err: Error) {
- for a.used > 0 && a.digit[a.used - 1] == 0 { a.used -= 1; }
+ for a.used > 0 && a.digit[a.used - 1] == 0 { a.used -= 1 }
- if #force_inline internal_is_zero(a) { a.sign = .Zero_or_Positive; }
+ if #force_inline internal_is_zero(a) { a.sign = .Zero_or_Positive }
return nil
}
diff --git a/core/math/big/logical.odin b/core/math/big/logical.odin
index d455d480d..008450319 100644
--- a/core/math/big/logical.odin
+++ b/core/math/big/logical.odin
@@ -77,7 +77,7 @@ int_shrmod :: proc(quotient, remainder, numerator: ^Int, bits: int, allocator :=
assert_if_nil(quotient, numerator)
context.allocator = allocator
- if err = internal_clear_if_uninitialized(quotient, numerator); err != nil { return err; }
+ if err = internal_clear_if_uninitialized(quotient, numerator); err != nil { return err }
return #force_inline internal_int_shrmod(quotient, remainder, numerator, bits)
}
shrmod :: proc { int_shrmod, }
diff --git a/core/math/big/prime.odin b/core/math/big/prime.odin
index b943da83b..f78c1894c 100644
--- a/core/math/big/prime.odin
+++ b/core/math/big/prime.odin
@@ -183,7 +183,7 @@ internal_int_montgomery_setup :: proc(n: ^Int) -> (rho: DIGIT, err: Error) {
=> 2*(1) - (1) = 1
*/
b := n.digit[0]
- if b & 1 == 0 { return 0, .Invalid_Argument; }
+ if b & 1 == 0 { return 0, .Invalid_Argument }
x := (((b + 2) & 4) << 1) + b /* here x*a==1 mod 2**4 */
x *= 2 - (b * x) /* here x*a==1 mod 2**8 */
diff --git a/core/math/big/private.odin b/core/math/big/private.odin
index f0d73a008..241cd7441 100644
--- a/core/math/big/private.odin
+++ b/core/math/big/private.odin
@@ -1088,7 +1088,7 @@ _private_int_div_school :: proc(quotient, remainder, numerator, denominator: ^In
Step 3. for i from n down to (t + 1).
*/
#no_bounds_check for i := n; i >= (t + 1); i -= 1 {
- if (i > x.used) { continue; }
+ if (i > x.used) { continue }
/*
step 3.1 if xi == yt then set q{i-t-1} to b-1, otherwise set q{i-t-1} to (xi*b + x{i-1})/yt
@@ -1744,7 +1744,7 @@ _private_montgomery_reduce_comba :: proc(x, n: ^Int, rho: DIGIT, allocator := co
context.allocator = allocator
W: [_WARRAY]_WORD = ---
- if x.used > _WARRAY { return .Invalid_Argument; }
+ if x.used > _WARRAY { return .Invalid_Argument }
/*
Get old used count.
@@ -2022,7 +2022,7 @@ _private_inverse_modulo_odd :: proc(dest, a, b: ^Int, allocator := context.alloc
/*
2. [modified] `b` must be odd.
*/
- if internal_is_even(b) { return .Invalid_Argument; }
+ if internal_is_even(b) { return .Invalid_Argument }
/*
Init all our temps.
@@ -2042,7 +2042,7 @@ _private_inverse_modulo_odd :: proc(dest, a, b: ^Int, allocator := context.alloc
/*
If one of `x`, `y` is zero return an error!
*/
- if internal_is_zero(x) || internal_is_zero(y) { return .Invalid_Argument; }
+ if internal_is_zero(x) || internal_is_zero(y) { return .Invalid_Argument }
/*
3. `u` = `x`, `v` = `y`, `A` = 1, `B` = 0, `C` = 0, `D` = 1
@@ -2122,7 +2122,7 @@ _private_inverse_modulo_odd :: proc(dest, a, b: ^Int, allocator := context.alloc
/*
If not zero goto step 4.
*/
- if internal_is_zero(u) { break; }
+ if internal_is_zero(u) { break }
}
/*
diff --git a/core/math/big/public.odin b/core/math/big/public.odin
index 9f82e618b..d7c6ec19c 100644
--- a/core/math/big/public.odin
+++ b/core/math/big/public.odin
@@ -120,7 +120,7 @@ int_double :: proc(dest, src: ^Int, allocator := context.allocator) -> (err: Err
/*
Grow destination as required.
*/
- if dest != src { grow(dest, src.used + 1) or_return; }
+ if dest != src { grow(dest, src.used + 1) or_return }
return #force_inline internal_int_shl1(dest, src)
}
@@ -153,7 +153,7 @@ int_mul :: proc(dest, src, multiplier: ^Int, allocator := context.allocator) ->
mul :: proc { int_mul, int_mul_digit, }
-sqr :: proc(dest, src: ^Int) -> (err: Error) { return mul(dest, src, src); }
+sqr :: proc(dest, src: ^Int) -> (err: Error) { return mul(dest, src, src) }
/*
divmod.
@@ -165,7 +165,7 @@ int_divmod :: proc(quotient, remainder, numerator, denominator: ^Int, allocator
/*
Early out if neither of the results is wanted.
*/
- if quotient == nil && remainder == nil { return nil; }
+ if quotient == nil && remainder == nil { return nil }
internal_clear_if_uninitialized(numerator, denominator) or_return
return #force_inline internal_divmod(quotient, remainder, numerator, denominator)
@@ -275,7 +275,7 @@ sqrmod :: proc { int_sqrmod, }
int_factorial :: proc(res: ^Int, n: int, allocator := context.allocator) -> (err: Error) {
- if n < 0 || n > FACTORIAL_MAX_N { return .Invalid_Argument; }
+ if n < 0 || n > FACTORIAL_MAX_N { return .Invalid_Argument }
assert_if_nil(res)
return #force_inline internal_int_factorial(res, n, allocator)
@@ -302,8 +302,8 @@ int_choose_digit :: proc(res: ^Int, n, k: int, allocator := context.allocator) -
assert_if_nil(res)
context.allocator = allocator
- if n < 0 || n > FACTORIAL_MAX_N { return .Invalid_Argument; }
- if k > n { return internal_zero(res); }
+ if n < 0 || n > FACTORIAL_MAX_N { return .Invalid_Argument }
+ if k > n { return internal_zero(res) }
/*
res = n! / (k! * (n - k)!)
@@ -326,7 +326,7 @@ choose :: proc { int_choose_digit, }
Function computing both GCD and (if target isn't `nil`) also LCM.
*/
int_gcd_lcm :: proc(res_gcd, res_lcm, a, b: ^Int, allocator := context.allocator) -> (err: Error) {
- if res_gcd == nil && res_lcm == nil { return nil; }
+ if res_gcd == nil && res_lcm == nil { return nil }
assert_if_nil(a, b)
context.allocator = allocator
@@ -359,7 +359,7 @@ int_mod_bits :: proc(remainder, numerator: ^Int, bits: int, allocator := context
context.allocator = allocator
internal_clear_if_uninitialized(remainder, numerator) or_return
- if bits < 0 { return .Invalid_Argument; }
+ if bits < 0 { return .Invalid_Argument }
return #force_inline internal_int_mod_bits(remainder, numerator, bits)
}
@@ -439,7 +439,7 @@ int_root_n :: proc(dest, src: ^Int, n: int, allocator := context.allocator) -> (
/*
Fast path for n == 2.
*/
- if n == 2 { return sqrt(dest, src); }
+ if n == 2 { return sqrt(dest, src) }
assert_if_nil(dest, src)
/*
@@ -456,7 +456,7 @@ root_n :: proc { int_root_n, }
*/
int_is_initialized :: proc(a: ^Int) -> bool {
- if a == nil { return false; }
+ if a == nil { return false }
return #force_inline internal_int_is_initialized(a)
}
diff --git a/core/math/big/radix.odin b/core/math/big/radix.odin
index 8908f7775..f0a80d7b2 100644
--- a/core/math/big/radix.odin
+++ b/core/math/big/radix.odin
@@ -244,7 +244,7 @@ int_atoi :: proc(res: ^Int, input: string, radix := i8(10), allocator := context
Make sure the radix is ok.
*/
- if radix < 2 || radix > 64 { return .Invalid_Argument; }
+ if radix < 2 || radix > 64 { return .Invalid_Argument }
/*
Set the integer to the default of zero.
@@ -327,7 +327,7 @@ radix_size :: proc(a: ^Int, radix: i8, zero_terminate := false, allocator := con
a := a
assert_if_nil(a)
- if radix < 2 || radix > 64 { return -1, .Invalid_Argument; }
+ if radix < 2 || radix > 64 { return -1, .Invalid_Argument }
clear_if_uninitialized(a) or_return
if internal_is_zero(a) {
diff --git a/core/math/big/test.odin b/core/math/big/test.odin
index 8a48962cb..76cb6b7ef 100644
--- a/core/math/big/test.odin
+++ b/core/math/big/test.odin
@@ -44,17 +44,17 @@ PyRes :: struct {
aa, bb, sum := &Int{}, &Int{}, &Int{}
defer internal_destroy(aa, bb, sum)
- if err = atoi(aa, string(a), 16); err != nil { return PyRes{res=":add:atoi(a):", err=err}; }
- if err = atoi(bb, string(b), 16); err != nil { return PyRes{res=":add:atoi(b):", err=err}; }
+ if err = atoi(aa, string(a), 16); err != nil { return PyRes{res=":add:atoi(a):", err=err} }
+ if err = atoi(bb, string(b), 16); err != nil { return PyRes{res=":add:atoi(b):", err=err} }
if bb.used == 1 {
- if err = #force_inline internal_add(sum, aa, bb.digit[0]); err != nil { return PyRes{res=":add:add(sum,a,b):", err=err}; }
+ if err = #force_inline internal_add(sum, aa, bb.digit[0]); err != nil { return PyRes{res=":add:add(sum,a,b):", err=err} }
} else {
- if err = #force_inline internal_add(sum, aa, bb); err != nil { return PyRes{res=":add:add(sum,a,b):", err=err}; }
+ if err = #force_inline internal_add(sum, aa, bb); err != nil { return PyRes{res=":add:add(sum,a,b):", err=err} }
}
r: cstring
r, err = int_itoa_cstring(sum, 16, context.temp_allocator)
- if err != nil { return PyRes{res=":add:itoa(sum):", err=err}; }
+ if err != nil { return PyRes{res=":add:itoa(sum):", err=err} }
return PyRes{res = r, err = nil}
}
@@ -65,17 +65,17 @@ PyRes :: struct {
aa, bb, sum := &Int{}, &Int{}, &Int{}
defer internal_destroy(aa, bb, sum)
- if err = atoi(aa, string(a), 16); err != nil { return PyRes{res=":sub:atoi(a):", err=err}; }
- if err = atoi(bb, string(b), 16); err != nil { return PyRes{res=":sub:atoi(b):", err=err}; }
+ if err = atoi(aa, string(a), 16); err != nil { return PyRes{res=":sub:atoi(a):", err=err} }
+ if err = atoi(bb, string(b), 16); err != nil { return PyRes{res=":sub:atoi(b):", err=err} }
if bb.used == 1 {
- if err = #force_inline internal_sub(sum, aa, bb.digit[0]); err != nil { return PyRes{res=":sub:sub(sum,a,b):", err=err}; }
+ if err = #force_inline internal_sub(sum, aa, bb.digit[0]); err != nil { return PyRes{res=":sub:sub(sum,a,b):", err=err} }
} else {
- if err = #force_inline internal_sub(sum, aa, bb); err != nil { return PyRes{res=":sub:sub(sum,a,b):", err=err}; }
+ if err = #force_inline internal_sub(sum, aa, bb); err != nil { return PyRes{res=":sub:sub(sum,a,b):", err=err} }
}
r: cstring
r, err = int_itoa_cstring(sum, 16, context.temp_allocator)
- if err != nil { return PyRes{res=":sub:itoa(sum):", err=err}; }
+ if err != nil { return PyRes{res=":sub:itoa(sum):", err=err} }
return PyRes{res = r, err = nil}
}
@@ -86,13 +86,13 @@ PyRes :: struct {
aa, bb, product := &Int{}, &Int{}, &Int{}
defer internal_destroy(aa, bb, product)
- if err = atoi(aa, string(a), 16); err != nil { return PyRes{res=":mul:atoi(a):", err=err}; }
- if err = atoi(bb, string(b), 16); err != nil { return PyRes{res=":mul:atoi(b):", err=err}; }
- if err = #force_inline internal_mul(product, aa, bb); err != nil { return PyRes{res=":mul:mul(product,a,b):", err=err}; }
+ if err = atoi(aa, string(a), 16); err != nil { return PyRes{res=":mul:atoi(a):", err=err} }
+ if err = atoi(bb, string(b), 16); err != nil { return PyRes{res=":mul:atoi(b):", err=err} }
+ if err = #force_inline internal_mul(product, aa, bb); err != nil { return PyRes{res=":mul:mul(product,a,b):", err=err} }
r: cstring
r, err = int_itoa_cstring(product, 16, context.temp_allocator)
- if err != nil { return PyRes{res=":mul:itoa(product):", err=err}; }
+ if err != nil { return PyRes{res=":mul:itoa(product):", err=err} }
return PyRes{res = r, err = nil}
}
@@ -103,12 +103,12 @@ PyRes :: struct {
aa, square := &Int{}, &Int{}
defer internal_destroy(aa, square)
- if err = atoi(aa, string(a), 16); err != nil { return PyRes{res=":sqr:atoi(a):", err=err}; }
- if err = #force_inline internal_sqr(square, aa); err != nil { return PyRes{res=":sqr:sqr(square,a):", err=err}; }
+ if err = atoi(aa, string(a), 16); err != nil { return PyRes{res=":sqr:atoi(a):", err=err} }
+ if err = #force_inline internal_sqr(square, aa); err != nil { return PyRes{res=":sqr:sqr(square,a):", err=err} }
r: cstring
r, err = int_itoa_cstring(square, 16, context.temp_allocator)
- if err != nil { return PyRes{res=":sqr:itoa(square):", err=err}; }
+ if err != nil { return PyRes{res=":sqr:itoa(square):", err=err} }
return PyRes{res = r, err = nil}
}
@@ -122,13 +122,13 @@ PyRes :: struct {
aa, bb, quotient := &Int{}, &Int{}, &Int{}
defer internal_destroy(aa, bb, quotient)
- if err = atoi(aa, string(a), 16); err != nil { return PyRes{res=":div:atoi(a):", err=err}; }
- if err = atoi(bb, string(b), 16); err != nil { return PyRes{res=":div:atoi(b):", err=err}; }
- if err = #force_inline internal_div(quotient, aa, bb); err != nil { return PyRes{res=":div:div(quotient,a,b):", err=err}; }
+ if err = atoi(aa, string(a), 16); err != nil { return PyRes{res=":div:atoi(a):", err=err} }
+ if err = atoi(bb, string(b), 16); err != nil { return PyRes{res=":div:atoi(b):", err=err} }
+ if err = #force_inline internal_div(quotient, aa, bb); err != nil { return PyRes{res=":div:div(quotient,a,b):", err=err} }
r: cstring
r, err = int_itoa_cstring(quotient, 16, context.temp_allocator)
- if err != nil { return PyRes{res=":div:itoa(quotient):", err=err}; }
+ if err != nil { return PyRes{res=":div:itoa(quotient):", err=err} }
return PyRes{res = r, err = nil}
}
@@ -144,8 +144,8 @@ PyRes :: struct {
aa := &Int{}
defer internal_destroy(aa)
- if err = atoi(aa, string(a), 16); err != nil { return PyRes{res=":log:atoi(a):", err=err}; }
- if l, err = #force_inline internal_log(aa, base); err != nil { return PyRes{res=":log:log(a, base):", err=err}; }
+ if err = atoi(aa, string(a), 16); err != nil { return PyRes{res=":log:atoi(a):", err=err} }
+ if l, err = #force_inline internal_log(aa, base); err != nil { return PyRes{res=":log:log(a, base):", err=err} }
#force_inline internal_zero(aa)
aa.digit[0] = DIGIT(l) & _MASK
@@ -155,7 +155,7 @@ PyRes :: struct {
r: cstring
r, err = int_itoa_cstring(aa, 16, context.temp_allocator)
- if err != nil { return PyRes{res=":log:itoa(res):", err=err}; }
+ if err != nil { return PyRes{res=":log:itoa(res):", err=err} }
return PyRes{res = r, err = nil}
}
@@ -169,12 +169,12 @@ PyRes :: struct {
dest, bb := &Int{}, &Int{}
defer internal_destroy(dest, bb)
- if err = atoi(bb, string(base), 16); err != nil { return PyRes{res=":pow:atoi(base):", err=err}; }
- if err = #force_inline internal_pow(dest, bb, power); err != nil { return PyRes{res=":pow:pow(dest, base, power):", err=err}; }
+ if err = atoi(bb, string(base), 16); err != nil { return PyRes{res=":pow:atoi(base):", err=err} }
+ if err = #force_inline internal_pow(dest, bb, power); err != nil { return PyRes{res=":pow:pow(dest, base, power):", err=err} }
r: cstring
r, err = int_itoa_cstring(dest, 16, context.temp_allocator)
- if err != nil { return PyRes{res=":log:itoa(res):", err=err}; }
+ if err != nil { return PyRes{res=":log:itoa(res):", err=err} }
return PyRes{res = r, err = nil}
}
@@ -188,12 +188,12 @@ PyRes :: struct {
src := &Int{}
defer internal_destroy(src)
- if err = atoi(src, string(source), 16); err != nil { return PyRes{res=":sqrt:atoi(src):", err=err}; }
- if err = #force_inline internal_sqrt(src, src); err != nil { return PyRes{res=":sqrt:sqrt(src):", err=err}; }
+ if err = atoi(src, string(source), 16); err != nil { return PyRes{res=":sqrt:atoi(src):", err=err} }
+ if err = #force_inline internal_sqrt(src, src); err != nil { return PyRes{res=":sqrt:sqrt(src):", err=err} }
r: cstring
r, err = int_itoa_cstring(src, 16, context.temp_allocator)
- if err != nil { return PyRes{res=":log:itoa(res):", err=err}; }
+ if err != nil { return PyRes{res=":log:itoa(res):", err=err} }
return PyRes{res = r, err = nil}
}
@@ -207,12 +207,12 @@ PyRes :: struct {
src := &Int{}
defer internal_destroy(src)
- if err = atoi(src, string(source), 16); err != nil { return PyRes{res=":root_n:atoi(src):", err=err}; }
- if err = #force_inline internal_root_n(src, src, power); err != nil { return PyRes{res=":root_n:root_n(src):", err=err}; }
+ if err = atoi(src, string(source), 16); err != nil { return PyRes{res=":root_n:atoi(src):", err=err} }
+ if err = #force_inline internal_root_n(src, src, power); err != nil { return PyRes{res=":root_n:root_n(src):", err=err} }
r: cstring
r, err = int_itoa_cstring(src, 16, context.temp_allocator)
- if err != nil { return PyRes{res=":root_n:itoa(res):", err=err}; }
+ if err != nil { return PyRes{res=":root_n:itoa(res):", err=err} }
return PyRes{res = r, err = nil}
}
@@ -226,12 +226,12 @@ PyRes :: struct {
src := &Int{}
defer internal_destroy(src)
- if err = atoi(src, string(source), 16); err != nil { return PyRes{res=":shr_digit:atoi(src):", err=err}; }
- if err = #force_inline internal_shr_digit(src, digits); err != nil { return PyRes{res=":shr_digit:shr_digit(src):", err=err}; }
+ if err = atoi(src, string(source), 16); err != nil { return PyRes{res=":shr_digit:atoi(src):", err=err} }
+ if err = #force_inline internal_shr_digit(src, digits); err != nil { return PyRes{res=":shr_digit:shr_digit(src):", err=err} }
r: cstring
r, err = int_itoa_cstring(src, 16, context.temp_allocator)
- if err != nil { return PyRes{res=":shr_digit:itoa(res):", err=err}; }
+ if err != nil { return PyRes{res=":shr_digit:itoa(res):", err=err} }
return PyRes{res = r, err = nil}
}
@@ -245,12 +245,12 @@ PyRes :: struct {
src := &Int{}
defer internal_destroy(src)
- if err = atoi(src, string(source), 16); err != nil { return PyRes{res=":shl_digit:atoi(src):", err=err}; }
- if err = #force_inline internal_shl_digit(src, digits); err != nil { return PyRes{res=":shl_digit:shr_digit(src):", err=err}; }
+ if err = atoi(src, string(source), 16); err != nil { return PyRes{res=":shl_digit:atoi(src):", err=err} }
+ if err = #force_inline internal_shl_digit(src, digits); err != nil { return PyRes{res=":shl_digit:shr_digit(src):", err=err} }
r: cstring
r, err = int_itoa_cstring(src, 16, context.temp_allocator)
- if err != nil { return PyRes{res=":shl_digit:itoa(res):", err=err}; }
+ if err != nil { return PyRes{res=":shl_digit:itoa(res):", err=err} }
return PyRes{res = r, err = nil}
}
@@ -264,12 +264,12 @@ PyRes :: struct {
src := &Int{}
defer internal_destroy(src)
- if err = atoi(src, string(source), 16); err != nil { return PyRes{res=":shr:atoi(src):", err=err}; }
- if err = #force_inline internal_shr(src, src, bits); err != nil { return PyRes{res=":shr:shr(src, bits):", err=err}; }
+ if err = atoi(src, string(source), 16); err != nil { return PyRes{res=":shr:atoi(src):", err=err} }
+ if err = #force_inline internal_shr(src, src, bits); err != nil { return PyRes{res=":shr:shr(src, bits):", err=err} }
r: cstring
r, err = int_itoa_cstring(src, 16, context.temp_allocator)
- if err != nil { return PyRes{res=":shr:itoa(res):", err=err}; }
+ if err != nil { return PyRes{res=":shr:itoa(res):", err=err} }
return PyRes{res = r, err = nil}
}
@@ -283,12 +283,12 @@ PyRes :: struct {
src := &Int{}
defer internal_destroy(src)
- if err = atoi(src, string(source), 16); err != nil { return PyRes{res=":shr_signed:atoi(src):", err=err}; }
- if err = #force_inline internal_shr_signed(src, src, bits); err != nil { return PyRes{res=":shr_signed:shr_signed(src, bits):", err=err}; }
+ if err = atoi(src, string(source), 16); err != nil { return PyRes{res=":shr_signed:atoi(src):", err=err} }
+ if err = #force_inline internal_shr_signed(src, src, bits); err != nil { return PyRes{res=":shr_signed:shr_signed(src, bits):", err=err} }
r: cstring
r, err = int_itoa_cstring(src, 16, context.temp_allocator)
- if err != nil { return PyRes{res=":shr_signed:itoa(res):", err=err}; }
+ if err != nil { return PyRes{res=":shr_signed:itoa(res):", err=err} }
return PyRes{res = r, err = nil}
}
@@ -302,12 +302,12 @@ PyRes :: struct {
src := &Int{}
defer internal_destroy(src)
- if err = atoi(src, string(source), 16); err != nil { return PyRes{res=":shl:atoi(src):", err=err}; }
- if err = #force_inline internal_shl(src, src, bits); err != nil { return PyRes{res=":shl:shl(src, bits):", err=err}; }
+ if err = atoi(src, string(source), 16); err != nil { return PyRes{res=":shl:atoi(src):", err=err} }
+ if err = #force_inline internal_shl(src, src, bits); err != nil { return PyRes{res=":shl:shl(src, bits):", err=err} }
r: cstring
r, err = int_itoa_cstring(src, 16, context.temp_allocator)
- if err != nil { return PyRes{res=":shl:itoa(res):", err=err}; }
+ if err != nil { return PyRes{res=":shl:itoa(res):", err=err} }
return PyRes{res = r, err = nil}
}
@@ -321,11 +321,11 @@ PyRes :: struct {
dest := &Int{}
defer internal_destroy(dest)
- if err = #force_inline internal_int_factorial(dest, n); err != nil { return PyRes{res=":factorial:factorial(n):", err=err}; }
+ if err = #force_inline internal_int_factorial(dest, n); err != nil { return PyRes{res=":factorial:factorial(n):", err=err} }
r: cstring
r, err = int_itoa_cstring(dest, 16, context.temp_allocator)
- if err != nil { return PyRes{res=":factorial:itoa(res):", err=err}; }
+ if err != nil { return PyRes{res=":factorial:itoa(res):", err=err} }
return PyRes{res = r, err = nil}
}
@@ -339,13 +339,13 @@ PyRes :: struct {
ai, bi, dest := &Int{}, &Int{}, &Int{}
defer internal_destroy(ai, bi, dest)
- if err = atoi(ai, string(a), 16); err != nil { return PyRes{res=":gcd:atoi(a):", err=err}; }
- if err = atoi(bi, string(b), 16); err != nil { return PyRes{res=":gcd:atoi(b):", err=err}; }
- if err = #force_inline internal_int_gcd_lcm(dest, nil, ai, bi); err != nil { return PyRes{res=":gcd:gcd(a, b):", err=err}; }
+ if err = atoi(ai, string(a), 16); err != nil { return PyRes{res=":gcd:atoi(a):", err=err} }
+ if err = atoi(bi, string(b), 16); err != nil { return PyRes{res=":gcd:atoi(b):", err=err} }
+ if err = #force_inline internal_int_gcd_lcm(dest, nil, ai, bi); err != nil { return PyRes{res=":gcd:gcd(a, b):", err=err} }
r: cstring
r, err = int_itoa_cstring(dest, 16, context.temp_allocator)
- if err != nil { return PyRes{res=":gcd:itoa(res):", err=err}; }
+ if err != nil { return PyRes{res=":gcd:itoa(res):", err=err} }
return PyRes{res = r, err = nil}
}
@@ -359,13 +359,13 @@ PyRes :: struct {
ai, bi, dest := &Int{}, &Int{}, &Int{}
defer internal_destroy(ai, bi, dest)
- if err = atoi(ai, string(a), 16); err != nil { return PyRes{res=":lcm:atoi(a):", err=err}; }
- if err = atoi(bi, string(b), 16); err != nil { return PyRes{res=":lcm:atoi(b):", err=err}; }
- if err = #force_inline internal_int_gcd_lcm(nil, dest, ai, bi); err != nil { return PyRes{res=":lcm:lcm(a, b):", err=err}; }
+ if err = atoi(ai, string(a), 16); err != nil { return PyRes{res=":lcm:atoi(a):", err=err} }
+ if err = atoi(bi, string(b), 16); err != nil { return PyRes{res=":lcm:atoi(b):", err=err} }
+ if err = #force_inline internal_int_gcd_lcm(nil, dest, ai, bi); err != nil { return PyRes{res=":lcm:lcm(a, b):", err=err} }
r: cstring
r, err = int_itoa_cstring(dest, 16, context.temp_allocator)
- if err != nil { return PyRes{res=":lcm:itoa(res):", err=err}; }
+ if err != nil { return PyRes{res=":lcm:itoa(res):", err=err} }
return PyRes{res = r, err = nil}
}
@@ -380,8 +380,8 @@ PyRes :: struct {
ai := &Int{}
defer internal_destroy(ai)
- if err = atoi(ai, string(a), 16); err != nil { return PyRes{res=":is_square:atoi(a):", err=err}; }
- if square, err = #force_inline internal_int_is_square(ai); err != nil { return PyRes{res=":is_square:is_square(a):", err=err}; }
+ if err = atoi(ai, string(a), 16); err != nil { return PyRes{res=":is_square:atoi(a):", err=err} }
+ if square, err = #force_inline internal_int_is_square(ai); err != nil { return PyRes{res=":is_square:is_square(a):", err=err} }
if square {
return PyRes{"True", nil}
diff --git a/core/math/bits/bits.odin b/core/math/bits/bits.odin
index 0d05b356d..ff16e9aa0 100644
--- a/core/math/bits/bits.odin
+++ b/core/math/bits/bits.odin
@@ -64,30 +64,30 @@ rotate_left :: proc(x: uint, k: int) -> uint {
return x <<s | x>>(n-s)
}
-from_be_u8 :: proc(i: u8) -> u8 { return i; }
-from_be_u16 :: proc(i: u16) -> u16 { when ODIN_ENDIAN == "big" { return i; } else { return byte_swap(i); } }
-from_be_u32 :: proc(i: u32) -> u32 { when ODIN_ENDIAN == "big" { return i; } else { return byte_swap(i); } }
-from_be_u64 :: proc(i: u64) -> u64 { when ODIN_ENDIAN == "big" { return i; } else { return byte_swap(i); } }
-from_be_uint :: proc(i: uint) -> uint { when ODIN_ENDIAN == "big" { return i; } else { return byte_swap(i); } }
+from_be_u8 :: proc(i: u8) -> u8 { return i }
+from_be_u16 :: proc(i: u16) -> u16 { when ODIN_ENDIAN == "big" { return i } else { return byte_swap(i) } }
+from_be_u32 :: proc(i: u32) -> u32 { when ODIN_ENDIAN == "big" { return i } else { return byte_swap(i) } }
+from_be_u64 :: proc(i: u64) -> u64 { when ODIN_ENDIAN == "big" { return i } else { return byte_swap(i) } }
+from_be_uint :: proc(i: uint) -> uint { when ODIN_ENDIAN == "big" { return i } else { return byte_swap(i) } }
-from_le_u8 :: proc(i: u8) -> u8 { return i; }
-from_le_u16 :: proc(i: u16) -> u16 { when ODIN_ENDIAN == "little" { return i; } else { return byte_swap(i); } }
-from_le_u32 :: proc(i: u32) -> u32 { when ODIN_ENDIAN == "little" { return i; } else { return byte_swap(i); } }
-from_le_u64 :: proc(i: u64) -> u64 { when ODIN_ENDIAN == "little" { return i; } else { return byte_swap(i); } }
-from_le_uint :: proc(i: uint) -> uint { when ODIN_ENDIAN == "little" { return i; } else { return byte_swap(i); } }
+from_le_u8 :: proc(i: u8) -> u8 { return i }
+from_le_u16 :: proc(i: u16) -> u16 { when ODIN_ENDIAN == "little" { return i } else { return byte_swap(i) } }
+from_le_u32 :: proc(i: u32) -> u32 { when ODIN_ENDIAN == "little" { return i } else { return byte_swap(i) } }
+from_le_u64 :: proc(i: u64) -> u64 { when ODIN_ENDIAN == "little" { return i } else { return byte_swap(i) } }
+from_le_uint :: proc(i: uint) -> uint { when ODIN_ENDIAN == "little" { return i } else { return byte_swap(i) } }
-to_be_u8 :: proc(i: u8) -> u8 { return i; }
-to_be_u16 :: proc(i: u16) -> u16 { when ODIN_ENDIAN == "big" { return i; } else { return byte_swap(i); } }
-to_be_u32 :: proc(i: u32) -> u32 { when ODIN_ENDIAN == "big" { return i; } else { return byte_swap(i); } }
-to_be_u64 :: proc(i: u64) -> u64 { when ODIN_ENDIAN == "big" { return i; } else { return byte_swap(i); } }
-to_be_uint :: proc(i: uint) -> uint { when ODIN_ENDIAN == "big" { return i; } else { return byte_swap(i); } }
+to_be_u8 :: proc(i: u8) -> u8 { return i }
+to_be_u16 :: proc(i: u16) -> u16 { when ODIN_ENDIAN == "big" { return i } else { return byte_swap(i) } }
+to_be_u32 :: proc(i: u32) -> u32 { when ODIN_ENDIAN == "big" { return i } else { return byte_swap(i) } }
+to_be_u64 :: proc(i: u64) -> u64 { when ODIN_ENDIAN == "big" { return i } else { return byte_swap(i) } }
+to_be_uint :: proc(i: uint) -> uint { when ODIN_ENDIAN == "big" { return i } else { return byte_swap(i) } }
-to_le_u8 :: proc(i: u8) -> u8 { return i; }
-to_le_u16 :: proc(i: u16) -> u16 { when ODIN_ENDIAN == "little" { return i; } else { return byte_swap(i); } }
-to_le_u32 :: proc(i: u32) -> u32 { when ODIN_ENDIAN == "little" { return i; } else { return byte_swap(i); } }
-to_le_u64 :: proc(i: u64) -> u64 { when ODIN_ENDIAN == "little" { return i; } else { return byte_swap(i); } }
-to_le_uint :: proc(i: uint) -> uint { when ODIN_ENDIAN == "little" { return i; } else { return byte_swap(i); } }
+to_le_u8 :: proc(i: u8) -> u8 { return i }
+to_le_u16 :: proc(i: u16) -> u16 { when ODIN_ENDIAN == "little" { return i } else { return byte_swap(i) } }
+to_le_u32 :: proc(i: u32) -> u32 { when ODIN_ENDIAN == "little" { return i } else { return byte_swap(i) } }
+to_le_u64 :: proc(i: u64) -> u64 { when ODIN_ENDIAN == "little" { return i } else { return byte_swap(i) } }
+to_le_uint :: proc(i: uint) -> uint { when ODIN_ENDIAN == "little" { return i } else { return byte_swap(i) } }
@@ -294,16 +294,16 @@ div :: proc{div_u32, div_u64, div_uint}
-is_power_of_two_u8 :: proc(i: u8) -> bool { return i > 0 && (i & (i-1)) == 0; }
-is_power_of_two_i8 :: proc(i: i8) -> bool { return i > 0 && (i & (i-1)) == 0; }
-is_power_of_two_u16 :: proc(i: u16) -> bool { return i > 0 && (i & (i-1)) == 0; }
-is_power_of_two_i16 :: proc(i: i16) -> bool { return i > 0 && (i & (i-1)) == 0; }
-is_power_of_two_u32 :: proc(i: u32) -> bool { return i > 0 && (i & (i-1)) == 0; }
-is_power_of_two_i32 :: proc(i: i32) -> bool { return i > 0 && (i & (i-1)) == 0; }
-is_power_of_two_u64 :: proc(i: u64) -> bool { return i > 0 && (i & (i-1)) == 0; }
-is_power_of_two_i64 :: proc(i: i64) -> bool { return i > 0 && (i & (i-1)) == 0; }
-is_power_of_two_uint :: proc(i: uint) -> bool { return i > 0 && (i & (i-1)) == 0; }
-is_power_of_two_int :: proc(i: int) -> bool { return i > 0 && (i & (i-1)) == 0; }
+is_power_of_two_u8 :: proc(i: u8) -> bool { return i > 0 && (i & (i-1)) == 0 }
+is_power_of_two_i8 :: proc(i: i8) -> bool { return i > 0 && (i & (i-1)) == 0 }
+is_power_of_two_u16 :: proc(i: u16) -> bool { return i > 0 && (i & (i-1)) == 0 }
+is_power_of_two_i16 :: proc(i: i16) -> bool { return i > 0 && (i & (i-1)) == 0 }
+is_power_of_two_u32 :: proc(i: u32) -> bool { return i > 0 && (i & (i-1)) == 0 }
+is_power_of_two_i32 :: proc(i: i32) -> bool { return i > 0 && (i & (i-1)) == 0 }
+is_power_of_two_u64 :: proc(i: u64) -> bool { return i > 0 && (i & (i-1)) == 0 }
+is_power_of_two_i64 :: proc(i: i64) -> bool { return i > 0 && (i & (i-1)) == 0 }
+is_power_of_two_uint :: proc(i: uint) -> bool { return i > 0 && (i & (i-1)) == 0 }
+is_power_of_two_int :: proc(i: int) -> bool { return i > 0 && (i & (i-1)) == 0 }
is_power_of_two :: proc{
is_power_of_two_u8, is_power_of_two_i8,
@@ -328,12 +328,12 @@ len_u8_table := [256]u8{
}
-bitfield_extract_u8 :: proc(value: u8, offset, bits: uint) -> u8 { return (value >> offset) & u8(1<<bits - 1); }
-bitfield_extract_u16 :: proc(value: u16, offset, bits: uint) -> u16 { return (value >> offset) & u16(1<<bits - 1); }
-bitfield_extract_u32 :: proc(value: u32, offset, bits: uint) -> u32 { return (value >> offset) & u32(1<<bits - 1); }
-bitfield_extract_u64 :: proc(value: u64, offset, bits: uint) -> u64 { return (value >> offset) & u64(1<<bits - 1); }
-bitfield_extract_u128 :: proc(value: u128, offset, bits: uint) -> u128 { return (value >> offset) & u128(1<<bits - 1); }
-bitfield_extract_uint :: proc(value: uint, offset, bits: uint) -> uint { return (value >> offset) & uint(1<<bits - 1); }
+bitfield_extract_u8 :: proc(value: u8, offset, bits: uint) -> u8 { return (value >> offset) & u8(1<<bits - 1) }
+bitfield_extract_u16 :: proc(value: u16, offset, bits: uint) -> u16 { return (value >> offset) & u16(1<<bits - 1) }
+bitfield_extract_u32 :: proc(value: u32, offset, bits: uint) -> u32 { return (value >> offset) & u32(1<<bits - 1) }
+bitfield_extract_u64 :: proc(value: u64, offset, bits: uint) -> u64 { return (value >> offset) & u64(1<<bits - 1) }
+bitfield_extract_u128 :: proc(value: u128, offset, bits: uint) -> u128 { return (value >> offset) & u128(1<<bits - 1) }
+bitfield_extract_uint :: proc(value: uint, offset, bits: uint) -> uint { return (value >> offset) & uint(1<<bits - 1) }
bitfield_extract_i8 :: proc(value: i8, offset, bits: uint) -> i8 {
v := (u8(value) >> offset) & u8(1<<bits - 1)
diff --git a/core/math/linalg/extended.odin b/core/math/linalg/extended.odin
index 8f7b2dd1e..ba64356ce 100644
--- a/core/math/linalg/extended.odin
+++ b/core/math/linalg/extended.odin
@@ -478,12 +478,12 @@ is_inf :: proc{is_inf_single, is_inf_array}
classify :: proc{classify_single, classify_array}
-less_than_single :: proc(x, y: $T) -> (out: bool) where !IS_ARRAY(T), IS_FLOAT(T) { return x < y; }
-less_than_equal_single :: proc(x, y: $T) -> (out: bool) where !IS_ARRAY(T), IS_FLOAT(T) { return x <= y; }
-greater_than_single :: proc(x, y: $T) -> (out: bool) where !IS_ARRAY(T), IS_FLOAT(T) { return x > y; }
-greater_than_equal_single :: proc(x, y: $T) -> (out: bool) where !IS_ARRAY(T), IS_FLOAT(T) { return x >= y; }
-equal_single :: proc(x, y: $T) -> (out: bool) where !IS_ARRAY(T), IS_FLOAT(T) { return x == y; }
-not_equal_single :: proc(x, y: $T) -> (out: bool) where !IS_ARRAY(T), IS_FLOAT(T) { return x != y; }
+less_than_single :: proc(x, y: $T) -> (out: bool) where !IS_ARRAY(T), IS_FLOAT(T) { return x < y }
+less_than_equal_single :: proc(x, y: $T) -> (out: bool) where !IS_ARRAY(T), IS_FLOAT(T) { return x <= y }
+greater_than_single :: proc(x, y: $T) -> (out: bool) where !IS_ARRAY(T), IS_FLOAT(T) { return x > y }
+greater_than_equal_single :: proc(x, y: $T) -> (out: bool) where !IS_ARRAY(T), IS_FLOAT(T) { return x >= y }
+equal_single :: proc(x, y: $T) -> (out: bool) where !IS_ARRAY(T), IS_FLOAT(T) { return x == y }
+not_equal_single :: proc(x, y: $T) -> (out: bool) where !IS_ARRAY(T), IS_FLOAT(T) { return x != y }
less_than_array :: proc(x, y: $A/[$N]$T) -> (out: [N]bool) where IS_ARRAY(A), IS_FLOAT(ELEM_TYPE(A)) {
for i in 0..<N {
diff --git a/core/math/linalg/general.odin b/core/math/linalg/general.odin
index 241a50f28..6c594945f 100644
--- a/core/math/linalg/general.odin
+++ b/core/math/linalg/general.odin
@@ -339,24 +339,24 @@ matrix_cast :: proc(v: $A/[$M][$N]$T, $Elem_Type: typeid) -> (w: [M][N]Elem_Type
return
}
-to_f32 :: #force_inline proc(v: $A/[$N]$T) -> [N]f32 { return array_cast(v, f32); }
-to_f64 :: #force_inline proc(v: $A/[$N]$T) -> [N]f64 { return array_cast(v, f64); }
-
-to_i8 :: #force_inline proc(v: $A/[$N]$T) -> [N]i8 { return array_cast(v, i8); }
-to_i16 :: #force_inline proc(v: $A/[$N]$T) -> [N]i16 { return array_cast(v, i16); }
-to_i32 :: #force_inline proc(v: $A/[$N]$T) -> [N]i32 { return array_cast(v, i32); }
-to_i64 :: #force_inline proc(v: $A/[$N]$T) -> [N]i64 { return array_cast(v, i64); }
-to_int :: #force_inline proc(v: $A/[$N]$T) -> [N]int { return array_cast(v, int); }
-
-to_u8 :: #force_inline proc(v: $A/[$N]$T) -> [N]u8 { return array_cast(v, u8); }
-to_u16 :: #force_inline proc(v: $A/[$N]$T) -> [N]u16 { return array_cast(v, u16); }
-to_u32 :: #force_inline proc(v: $A/[$N]$T) -> [N]u32 { return array_cast(v, u32); }
-to_u64 :: #force_inline proc(v: $A/[$N]$T) -> [N]u64 { return array_cast(v, u64); }
-to_uint :: #force_inline proc(v: $A/[$N]$T) -> [N]uint { return array_cast(v, uint); }
-
-to_complex32 :: #force_inline proc(v: $A/[$N]$T) -> [N]complex32 { return array_cast(v, complex32); }
-to_complex64 :: #force_inline proc(v: $A/[$N]$T) -> [N]complex64 { return array_cast(v, complex64); }
-to_complex128 :: #force_inline proc(v: $A/[$N]$T) -> [N]complex128 { return array_cast(v, complex128); }
-to_quaternion64 :: #force_inline proc(v: $A/[$N]$T) -> [N]quaternion64 { return array_cast(v, quaternion64); }
-to_quaternion128 :: #force_inline proc(v: $A/[$N]$T) -> [N]quaternion128 { return array_cast(v, quaternion128); }
-to_quaternion256 :: #force_inline proc(v: $A/[$N]$T) -> [N]quaternion256 { return array_cast(v, quaternion256); }
+to_f32 :: #force_inline proc(v: $A/[$N]$T) -> [N]f32 { return array_cast(v, f32) }
+to_f64 :: #force_inline proc(v: $A/[$N]$T) -> [N]f64 { return array_cast(v, f64) }
+
+to_i8 :: #force_inline proc(v: $A/[$N]$T) -> [N]i8 { return array_cast(v, i8) }
+to_i16 :: #force_inline proc(v: $A/[$N]$T) -> [N]i16 { return array_cast(v, i16) }
+to_i32 :: #force_inline proc(v: $A/[$N]$T) -> [N]i32 { return array_cast(v, i32) }
+to_i64 :: #force_inline proc(v: $A/[$N]$T) -> [N]i64 { return array_cast(v, i64) }
+to_int :: #force_inline proc(v: $A/[$N]$T) -> [N]int { return array_cast(v, int) }
+
+to_u8 :: #force_inline proc(v: $A/[$N]$T) -> [N]u8 { return array_cast(v, u8) }
+to_u16 :: #force_inline proc(v: $A/[$N]$T) -> [N]u16 { return array_cast(v, u16) }
+to_u32 :: #force_inline proc(v: $A/[$N]$T) -> [N]u32 { return array_cast(v, u32) }
+to_u64 :: #force_inline proc(v: $A/[$N]$T) -> [N]u64 { return array_cast(v, u64) }
+to_uint :: #force_inline proc(v: $A/[$N]$T) -> [N]uint { return array_cast(v, uint) }
+
+to_complex32 :: #force_inline proc(v: $A/[$N]$T) -> [N]complex32 { return array_cast(v, complex32) }
+to_complex64 :: #force_inline proc(v: $A/[$N]$T) -> [N]complex64 { return array_cast(v, complex64) }
+to_complex128 :: #force_inline proc(v: $A/[$N]$T) -> [N]complex128 { return array_cast(v, complex128) }
+to_quaternion64 :: #force_inline proc(v: $A/[$N]$T) -> [N]quaternion64 { return array_cast(v, quaternion64) }
+to_quaternion128 :: #force_inline proc(v: $A/[$N]$T) -> [N]quaternion128 { return array_cast(v, quaternion128) }
+to_quaternion256 :: #force_inline proc(v: $A/[$N]$T) -> [N]quaternion256 { return array_cast(v, quaternion256) }
diff --git a/core/math/linalg/specific.odin b/core/math/linalg/specific.odin
index 333d17e44..dd3803c99 100644
--- a/core/math/linalg/specific.odin
+++ b/core/math/linalg/specific.odin
@@ -260,8 +260,8 @@ vector4_linear_to_srgb :: proc{
vector4_hsl_to_rgb_f16 :: proc(h, s, l: f16, a: f16 = 1) -> Vector4f16 {
hue_to_rgb :: proc(p, q, t: f16) -> f16 {
t := t
- if t < 0 { t += 1; }
- if t > 1 { t -= 1; }
+ if t < 0 { t += 1 }
+ if t > 1 { t -= 1 }
switch {
case t < 1.0/6.0: return p + (q - p) * 6.0 * t
case t < 1.0/2.0: return q
@@ -287,8 +287,8 @@ vector4_hsl_to_rgb_f16 :: proc(h, s, l: f16, a: f16 = 1) -> Vector4f16 {
vector4_hsl_to_rgb_f32 :: proc(h, s, l: f32, a: f32 = 1) -> Vector4f32 {
hue_to_rgb :: proc(p, q, t: f32) -> f32 {
t := t
- if t < 0 { t += 1; }
- if t > 1 { t -= 1; }
+ if t < 0 { t += 1 }
+ if t > 1 { t -= 1 }
switch {
case t < 1.0/6.0: return p + (q - p) * 6.0 * t
case t < 1.0/2.0: return q
@@ -314,8 +314,8 @@ vector4_hsl_to_rgb_f32 :: proc(h, s, l: f32, a: f32 = 1) -> Vector4f32 {
vector4_hsl_to_rgb_f64 :: proc(h, s, l: f64, a: f64 = 1) -> Vector4f64 {
hue_to_rgb :: proc(p, q, t: f64) -> f64 {
t := t
- if t < 0 { t += 1; }
- if t > 1 { t -= 1; }
+ if t < 0 { t += 1 }
+ if t > 1 { t -= 1 }
switch {
case t < 1.0/6.0: return p + (q - p) * 6.0 * t
case t < 1.0/2.0: return q
diff --git a/core/math/math.odin b/core/math/math.odin
index 6a094cfd4..3b26a972f 100644
--- a/core/math/math.odin
+++ b/core/math/math.odin
@@ -96,96 +96,96 @@ foreign _ {
ldexp_f64 :: proc(val: f64, exp: i32) -> f64 ---
}
-sqrt_f16le :: proc(x: f16le) -> f16le { return #force_inline f16le(sqrt_f16(f16(x))); }
-sqrt_f16be :: proc(x: f16be) -> f16be { return #force_inline f16be(sqrt_f16(f16(x))); }
-sqrt_f32le :: proc(x: f32le) -> f32le { return #force_inline f32le(sqrt_f32(f32(x))); }
-sqrt_f32be :: proc(x: f32be) -> f32be { return #force_inline f32be(sqrt_f32(f32(x))); }
-sqrt_f64le :: proc(x: f64le) -> f64le { return #force_inline f64le(sqrt_f64(f64(x))); }
-sqrt_f64be :: proc(x: f64be) -> f64be { return #force_inline f64be(sqrt_f64(f64(x))); }
+sqrt_f16le :: proc(x: f16le) -> f16le { return #force_inline f16le(sqrt_f16(f16(x))) }
+sqrt_f16be :: proc(x: f16be) -> f16be { return #force_inline f16be(sqrt_f16(f16(x))) }
+sqrt_f32le :: proc(x: f32le) -> f32le { return #force_inline f32le(sqrt_f32(f32(x))) }
+sqrt_f32be :: proc(x: f32be) -> f32be { return #force_inline f32be(sqrt_f32(f32(x))) }
+sqrt_f64le :: proc(x: f64le) -> f64le { return #force_inline f64le(sqrt_f64(f64(x))) }
+sqrt_f64be :: proc(x: f64be) -> f64be { return #force_inline f64be(sqrt_f64(f64(x))) }
sqrt :: proc{
sqrt_f16, sqrt_f16le, sqrt_f16be,
sqrt_f32, sqrt_f32le, sqrt_f32be,
sqrt_f64, sqrt_f64le, sqrt_f64be,
}
-sin_f16le :: proc(θ: f16le) -> f16le { return #force_inline f16le(sin_f16(f16(θ))); }
-sin_f16be :: proc(θ: f16be) -> f16be { return #force_inline f16be(sin_f16(f16(θ))); }
-sin_f32le :: proc(θ: f32le) -> f32le { return #force_inline f32le(sin_f32(f32(θ))); }
-sin_f32be :: proc(θ: f32be) -> f32be { return #force_inline f32be(sin_f32(f32(θ))); }
-sin_f64le :: proc(θ: f64le) -> f64le { return #force_inline f64le(sin_f64(f64(θ))); }
-sin_f64be :: proc(θ: f64be) -> f64be { return #force_inline f64be(sin_f64(f64(θ))); }
+sin_f16le :: proc(θ: f16le) -> f16le { return #force_inline f16le(sin_f16(f16(θ))) }
+sin_f16be :: proc(θ: f16be) -> f16be { return #force_inline f16be(sin_f16(f16(θ))) }
+sin_f32le :: proc(θ: f32le) -> f32le { return #force_inline f32le(sin_f32(f32(θ))) }
+sin_f32be :: proc(θ: f32be) -> f32be { return #force_inline f32be(sin_f32(f32(θ))) }
+sin_f64le :: proc(θ: f64le) -> f64le { return #force_inline f64le(sin_f64(f64(θ))) }
+sin_f64be :: proc(θ: f64be) -> f64be { return #force_inline f64be(sin_f64(f64(θ))) }
sin :: proc{
sin_f16, sin_f16le, sin_f16be,
sin_f32, sin_f32le, sin_f32be,
sin_f64, sin_f64le, sin_f64be,
}
-cos_f16le :: proc(θ: f16le) -> f16le { return #force_inline f16le(cos_f16(f16(θ))); }
-cos_f16be :: proc(θ: f16be) -> f16be { return #force_inline f16be(cos_f16(f16(θ))); }
-cos_f32le :: proc(θ: f32le) -> f32le { return #force_inline f32le(cos_f32(f32(θ))); }
-cos_f32be :: proc(θ: f32be) -> f32be { return #force_inline f32be(cos_f32(f32(θ))); }
-cos_f64le :: proc(θ: f64le) -> f64le { return #force_inline f64le(cos_f64(f64(θ))); }
-cos_f64be :: proc(θ: f64be) -> f64be { return #force_inline f64be(cos_f64(f64(θ))); }
+cos_f16le :: proc(θ: f16le) -> f16le { return #force_inline f16le(cos_f16(f16(θ))) }
+cos_f16be :: proc(θ: f16be) -> f16be { return #force_inline f16be(cos_f16(f16(θ))) }
+cos_f32le :: proc(θ: f32le) -> f32le { return #force_inline f32le(cos_f32(f32(θ))) }
+cos_f32be :: proc(θ: f32be) -> f32be { return #force_inline f32be(cos_f32(f32(θ))) }
+cos_f64le :: proc(θ: f64le) -> f64le { return #force_inline f64le(cos_f64(f64(θ))) }
+cos_f64be :: proc(θ: f64be) -> f64be { return #force_inline f64be(cos_f64(f64(θ))) }
cos :: proc{
cos_f16, cos_f16le, cos_f16be,
cos_f32, cos_f32le, cos_f32be,
cos_f64, cos_f64le, cos_f64be,
}
-pow_f16le :: proc(x, power: f16le) -> f16le { return #force_inline f16le(pow_f16(f16(x), f16(power))); }
-pow_f16be :: proc(x, power: f16be) -> f16be { return #force_inline f16be(pow_f16(f16(x), f16(power))); }
-pow_f32le :: proc(x, power: f32le) -> f32le { return #force_inline f32le(pow_f32(f32(x), f32(power))); }
-pow_f32be :: proc(x, power: f32be) -> f32be { return #force_inline f32be(pow_f32(f32(x), f32(power))); }
-pow_f64le :: proc(x, power: f64le) -> f64le { return #force_inline f64le(pow_f64(f64(x), f64(power))); }
-pow_f64be :: proc(x, power: f64be) -> f64be { return #force_inline f64be(pow_f64(f64(x), f64(power))); }
+pow_f16le :: proc(x, power: f16le) -> f16le { return #force_inline f16le(pow_f16(f16(x), f16(power))) }
+pow_f16be :: proc(x, power: f16be) -> f16be { return #force_inline f16be(pow_f16(f16(x), f16(power))) }
+pow_f32le :: proc(x, power: f32le) -> f32le { return #force_inline f32le(pow_f32(f32(x), f32(power))) }
+pow_f32be :: proc(x, power: f32be) -> f32be { return #force_inline f32be(pow_f32(f32(x), f32(power))) }
+pow_f64le :: proc(x, power: f64le) -> f64le { return #force_inline f64le(pow_f64(f64(x), f64(power))) }
+pow_f64be :: proc(x, power: f64be) -> f64be { return #force_inline f64be(pow_f64(f64(x), f64(power))) }
pow :: proc{
pow_f16, pow_f16le, pow_f16be,
pow_f32, pow_f32le, pow_f32be,
pow_f64, pow_f64le, pow_f64be,
}
-fmuladd_f16le :: proc(a, b, c: f16le) -> f16le { return #force_inline f16le(fmuladd_f16(f16(a), f16(b), f16(c))); }
-fmuladd_f16be :: proc(a, b, c: f16be) -> f16be { return #force_inline f16be(fmuladd_f16(f16(a), f16(b), f16(c))); }
-fmuladd_f32le :: proc(a, b, c: f32le) -> f32le { return #force_inline f32le(fmuladd_f32(f32(a), f32(b), f32(c))); }
-fmuladd_f32be :: proc(a, b, c: f32be) -> f32be { return #force_inline f32be(fmuladd_f32(f32(a), f32(b), f32(c))); }
-fmuladd_f64le :: proc(a, b, c: f64le) -> f64le { return #force_inline f64le(fmuladd_f64(f64(a), f64(b), f64(c))); }
-fmuladd_f64be :: proc(a, b, c: f64be) -> f64be { return #force_inline f64be(fmuladd_f64(f64(a), f64(b), f64(c))); }
+fmuladd_f16le :: proc(a, b, c: f16le) -> f16le { return #force_inline f16le(fmuladd_f16(f16(a), f16(b), f16(c))) }
+fmuladd_f16be :: proc(a, b, c: f16be) -> f16be { return #force_inline f16be(fmuladd_f16(f16(a), f16(b), f16(c))) }
+fmuladd_f32le :: proc(a, b, c: f32le) -> f32le { return #force_inline f32le(fmuladd_f32(f32(a), f32(b), f32(c))) }
+fmuladd_f32be :: proc(a, b, c: f32be) -> f32be { return #force_inline f32be(fmuladd_f32(f32(a), f32(b), f32(c))) }
+fmuladd_f64le :: proc(a, b, c: f64le) -> f64le { return #force_inline f64le(fmuladd_f64(f64(a), f64(b), f64(c))) }
+fmuladd_f64be :: proc(a, b, c: f64be) -> f64be { return #force_inline f64be(fmuladd_f64(f64(a), f64(b), f64(c))) }
fmuladd :: proc{
fmuladd_f16, fmuladd_f16le, fmuladd_f16be,
fmuladd_f32, fmuladd_f32le, fmuladd_f32be,
fmuladd_f64, fmuladd_f64le, fmuladd_f64be,
}
-ln_f16le :: proc(x: f16le) -> f16le { return #force_inline f16le(ln_f16(f16(x))); }
-ln_f16be :: proc(x: f16be) -> f16be { return #force_inline f16be(ln_f16(f16(x))); }
-ln_f32le :: proc(x: f32le) -> f32le { return #force_inline f32le(ln_f32(f32(x))); }
-ln_f32be :: proc(x: f32be) -> f32be { return #force_inline f32be(ln_f32(f32(x))); }
-ln_f64le :: proc(x: f64le) -> f64le { return #force_inline f64le(ln_f64(f64(x))); }
-ln_f64be :: proc(x: f64be) -> f64be { return #force_inline f64be(ln_f64(f64(x))); }
+ln_f16le :: proc(x: f16le) -> f16le { return #force_inline f16le(ln_f16(f16(x))) }
+ln_f16be :: proc(x: f16be) -> f16be { return #force_inline f16be(ln_f16(f16(x))) }
+ln_f32le :: proc(x: f32le) -> f32le { return #force_inline f32le(ln_f32(f32(x))) }
+ln_f32be :: proc(x: f32be) -> f32be { return #force_inline f32be(ln_f32(f32(x))) }
+ln_f64le :: proc(x: f64le) -> f64le { return #force_inline f64le(ln_f64(f64(x))) }
+ln_f64be :: proc(x: f64be) -> f64be { return #force_inline f64be(ln_f64(f64(x))) }
ln :: proc{
ln_f16, ln_f16le, ln_f16be,
ln_f32, ln_f32le, ln_f32be,
ln_f64, ln_f64le, ln_f64be,
}
-exp_f16le :: proc(x: f16le) -> f16le { return #force_inline f16le(exp_f16(f16(x))); }
-exp_f16be :: proc(x: f16be) -> f16be { return #force_inline f16be(exp_f16(f16(x))); }
-exp_f32le :: proc(x: f32le) -> f32le { return #force_inline f32le(exp_f32(f32(x))); }
-exp_f32be :: proc(x: f32be) -> f32be { return #force_inline f32be(exp_f32(f32(x))); }
-exp_f64le :: proc(x: f64le) -> f64le { return #force_inline f64le(exp_f64(f64(x))); }
-exp_f64be :: proc(x: f64be) -> f64be { return #force_inline f64be(exp_f64(f64(x))); }
+exp_f16le :: proc(x: f16le) -> f16le { return #force_inline f16le(exp_f16(f16(x))) }
+exp_f16be :: proc(x: f16be) -> f16be { return #force_inline f16be(exp_f16(f16(x))) }
+exp_f32le :: proc(x: f32le) -> f32le { return #force_inline f32le(exp_f32(f32(x))) }
+exp_f32be :: proc(x: f32be) -> f32be { return #force_inline f32be(exp_f32(f32(x))) }
+exp_f64le :: proc(x: f64le) -> f64le { return #force_inline f64le(exp_f64(f64(x))) }
+exp_f64be :: proc(x: f64be) -> f64be { return #force_inline f64be(exp_f64(f64(x))) }
exp :: proc{
exp_f16, exp_f16le, exp_f16be,
exp_f32, exp_f32le, exp_f32be,
exp_f64, exp_f64le, exp_f64be,
}
-ldexp_f16le :: proc(val: f16le, exp: i32) -> f16le { return #force_inline f16le(ldexp_f16(f16(val), exp)); }
-ldexp_f16be :: proc(val: f16be, exp: i32) -> f16be { return #force_inline f16be(ldexp_f16(f16(val), exp)); }
-ldexp_f32le :: proc(val: f32le, exp: i32) -> f32le { return #force_inline f32le(ldexp_f32(f32(val), exp)); }
-ldexp_f32be :: proc(val: f32be, exp: i32) -> f32be { return #force_inline f32be(ldexp_f32(f32(val), exp)); }
-ldexp_f64le :: proc(val: f64le, exp: i32) -> f64le { return #force_inline f64le(ldexp_f64(f64(val), exp)); }
-ldexp_f64be :: proc(val: f64be, exp: i32) -> f64be { return #force_inline f64be(ldexp_f64(f64(val), exp)); }
+ldexp_f16le :: proc(val: f16le, exp: i32) -> f16le { return #force_inline f16le(ldexp_f16(f16(val), exp)) }
+ldexp_f16be :: proc(val: f16be, exp: i32) -> f16be { return #force_inline f16be(ldexp_f16(f16(val), exp)) }
+ldexp_f32le :: proc(val: f32le, exp: i32) -> f32le { return #force_inline f32le(ldexp_f32(f32(val), exp)) }
+ldexp_f32be :: proc(val: f32be, exp: i32) -> f32be { return #force_inline f32be(ldexp_f32(f32(val), exp)) }
+ldexp_f64le :: proc(val: f64le, exp: i32) -> f64le { return #force_inline f64le(ldexp_f64(f64(val), exp)) }
+ldexp_f64be :: proc(val: f64be, exp: i32) -> f64be { return #force_inline f64be(ldexp_f64(f64(val), exp)) }
ldexp :: proc{
ldexp_f16, ldexp_f16le, ldexp_f16be,
ldexp_f32, ldexp_f32le, ldexp_f32be,
@@ -193,76 +193,76 @@ ldexp :: proc{
}
-log_f16 :: proc(x, base: f16) -> f16 { return ln(x) / ln(base); }
-log_f16le :: proc(x, base: f16le) -> f16le { return f16le(log_f16(f16(x), f16(base))); }
-log_f16be :: proc(x, base: f16be) -> f16be { return f16be(log_f16(f16(x), f16(base))); }
+log_f16 :: proc(x, base: f16) -> f16 { return ln(x) / ln(base) }
+log_f16le :: proc(x, base: f16le) -> f16le { return f16le(log_f16(f16(x), f16(base))) }
+log_f16be :: proc(x, base: f16be) -> f16be { return f16be(log_f16(f16(x), f16(base))) }
-log_f32 :: proc(x, base: f32) -> f32 { return ln(x) / ln(base); }
-log_f32le :: proc(x, base: f32le) -> f32le { return f32le(log_f32(f32(x), f32(base))); }
-log_f32be :: proc(x, base: f32be) -> f32be { return f32be(log_f32(f32(x), f32(base))); }
+log_f32 :: proc(x, base: f32) -> f32 { return ln(x) / ln(base) }
+log_f32le :: proc(x, base: f32le) -> f32le { return f32le(log_f32(f32(x), f32(base))) }
+log_f32be :: proc(x, base: f32be) -> f32be { return f32be(log_f32(f32(x), f32(base))) }
-log_f64 :: proc(x, base: f64) -> f64 { return ln(x) / ln(base); }
-log_f64le :: proc(x, base: f64le) -> f64le { return f64le(log_f64(f64(x), f64(base))); }
-log_f64be :: proc(x, base: f64be) -> f64be { return f64be(log_f64(f64(x), f64(base))); }
+log_f64 :: proc(x, base: f64) -> f64 { return ln(x) / ln(base) }
+log_f64le :: proc(x, base: f64le) -> f64le { return f64le(log_f64(f64(x), f64(base))) }
+log_f64be :: proc(x, base: f64be) -> f64be { return f64be(log_f64(f64(x), f64(base))) }
log :: proc{
log_f16, log_f16le, log_f16be,
log_f32, log_f32le, log_f32be,
log_f64, log_f64le, log_f64be,
}
-log2_f16 :: proc(x: f16) -> f16 { return ln(x)/LN2; }
-log2_f16le :: proc(x: f16le) -> f16le { return f16le(log2_f16(f16(x))); }
-log2_f16be :: proc(x: f16be) -> f16be { return f16be(log2_f16(f16(x))); }
+log2_f16 :: proc(x: f16) -> f16 { return ln(x)/LN2 }
+log2_f16le :: proc(x: f16le) -> f16le { return f16le(log2_f16(f16(x))) }
+log2_f16be :: proc(x: f16be) -> f16be { return f16be(log2_f16(f16(x))) }
-log2_f32 :: proc(x: f32) -> f32 { return ln(x)/LN2; }
-log2_f32le :: proc(x: f32le) -> f32le { return f32le(log2_f32(f32(x))); }
-log2_f32be :: proc(x: f32be) -> f32be { return f32be(log2_f32(f32(x))); }
+log2_f32 :: proc(x: f32) -> f32 { return ln(x)/LN2 }
+log2_f32le :: proc(x: f32le) -> f32le { return f32le(log2_f32(f32(x))) }
+log2_f32be :: proc(x: f32be) -> f32be { return f32be(log2_f32(f32(x))) }
-log2_f64 :: proc(x: f64) -> f64 { return ln(x)/LN2; }
-log2_f64le :: proc(x: f64le) -> f64le { return f64le(log2_f64(f64(x))); }
-log2_f64be :: proc(x: f64be) -> f64be { return f64be(log2_f64(f64(x))); }
+log2_f64 :: proc(x: f64) -> f64 { return ln(x)/LN2 }
+log2_f64le :: proc(x: f64le) -> f64le { return f64le(log2_f64(f64(x))) }
+log2_f64be :: proc(x: f64be) -> f64be { return f64be(log2_f64(f64(x))) }
log2 :: proc{
log2_f16, log2_f16le, log2_f16be,
log2_f32, log2_f32le, log2_f32be,
log2_f64, log2_f64le, log2_f64be,
}
-log10_f16 :: proc(x: f16) -> f16 { return ln(x)/LN10; }
-log10_f16le :: proc(x: f16le) -> f16le { return f16le(log10_f16(f16(x))); }
-log10_f16be :: proc(x: f16be) -> f16be { return f16be(log10_f16(f16(x))); }
+log10_f16 :: proc(x: f16) -> f16 { return ln(x)/LN10 }
+log10_f16le :: proc(x: f16le) -> f16le { return f16le(log10_f16(f16(x))) }
+log10_f16be :: proc(x: f16be) -> f16be { return f16be(log10_f16(f16(x))) }
-log10_f32 :: proc(x: f32) -> f32 { return ln(x)/LN10; }
-log10_f32le :: proc(x: f32le) -> f32le { return f32le(log10_f32(f32(x))); }
-log10_f32be :: proc(x: f32be) -> f32be { return f32be(log10_f32(f32(x))); }
+log10_f32 :: proc(x: f32) -> f32 { return ln(x)/LN10 }
+log10_f32le :: proc(x: f32le) -> f32le { return f32le(log10_f32(f32(x))) }
+log10_f32be :: proc(x: f32be) -> f32be { return f32be(log10_f32(f32(x))) }
-log10_f64 :: proc(x: f64) -> f64 { return ln(x)/LN10; }
-log10_f64le :: proc(x: f64le) -> f64le { return f64le(log10_f64(f64(x))); }
-log10_f64be :: proc(x: f64be) -> f64be { return f64be(log10_f64(f64(x))); }
+log10_f64 :: proc(x: f64) -> f64 { return ln(x)/LN10 }
+log10_f64le :: proc(x: f64le) -> f64le { return f64le(log10_f64(f64(x))) }
+log10_f64be :: proc(x: f64be) -> f64be { return f64be(log10_f64(f64(x))) }
log10 :: proc{
log10_f16, log10_f16le, log10_f16be,
log10_f32, log10_f32le, log10_f32be,
log10_f64, log10_f64le, log10_f64be,
}
-tan_f16 :: proc(θ: f16) -> f16 { return sin(θ)/cos(θ); }
-tan_f16le :: proc(θ: f16le) -> f16le { return f16le(tan_f16(f16(θ))); }
-tan_f16be :: proc(θ: f16be) -> f16be { return f16be(tan_f16(f16(θ))); }
+tan_f16 :: proc(θ: f16) -> f16 { return sin(θ)/cos(θ) }
+tan_f16le :: proc(θ: f16le) -> f16le { return f16le(tan_f16(f16(θ))) }
+tan_f16be :: proc(θ: f16be) -> f16be { return f16be(tan_f16(f16(θ))) }
-tan_f32 :: proc(θ: f32) -> f32 { return sin(θ)/cos(θ); }
-tan_f32le :: proc(θ: f32le) -> f32le { return f32le(tan_f32(f32(θ))); }
-tan_f32be :: proc(θ: f32be) -> f32be { return f32be(tan_f32(f32(θ))); }
+tan_f32 :: proc(θ: f32) -> f32 { return sin(θ)/cos(θ) }
+tan_f32le :: proc(θ: f32le) -> f32le { return f32le(tan_f32(f32(θ))) }
+tan_f32be :: proc(θ: f32be) -> f32be { return f32be(tan_f32(f32(θ))) }
-tan_f64 :: proc(θ: f64) -> f64 { return sin(θ)/cos(θ); }
-tan_f64le :: proc(θ: f64le) -> f64le { return f64le(tan_f64(f64(θ))); }
-tan_f64be :: proc(θ: f64be) -> f64be { return f64be(tan_f64(f64(θ))); }
+tan_f64 :: proc(θ: f64) -> f64 { return sin(θ)/cos(θ) }
+tan_f64le :: proc(θ: f64le) -> f64le { return f64le(tan_f64(f64(θ))) }
+tan_f64be :: proc(θ: f64be) -> f64be { return f64be(tan_f64(f64(θ))) }
tan :: proc{
tan_f16, tan_f16le, tan_f16be,
tan_f32, tan_f32le, tan_f32be,
tan_f64, tan_f64le, tan_f64be,
}
-lerp :: proc(a, b: $T, t: $E) -> (x: T) { return a*(1-t) + b*t; }
-saturate :: proc(a: $T) -> (x: T) { return clamp(a, 0, 1); }
+lerp :: proc(a, b: $T, t: $E) -> (x: T) { return a*(1-t) + b*t }
+saturate :: proc(a: $T) -> (x: T) { return clamp(a, 0, 1) }
unlerp :: proc(a, b, x: $T) -> (t: T) where intrinsics.type_is_float(T), !intrinsics.type_is_array(T) {
return (x-a)/(b-a)
@@ -311,15 +311,15 @@ gain :: proc(t, g: $T) -> T where intrinsics.type_is_numeric(T) {
}
-sign_f16 :: proc(x: f16) -> f16 { return f16(int(0 < x) - int(x < 0)); }
-sign_f16le :: proc(x: f16le) -> f16le { return f16le(int(0 < x) - int(x < 0)); }
-sign_f16be :: proc(x: f16be) -> f16be { return f16be(int(0 < x) - int(x < 0)); }
-sign_f32 :: proc(x: f32) -> f32 { return f32(int(0 < x) - int(x < 0)); }
-sign_f32le :: proc(x: f32le) -> f32le { return f32le(int(0 < x) - int(x < 0)); }
-sign_f32be :: proc(x: f32be) -> f32be { return f32be(int(0 < x) - int(x < 0)); }
-sign_f64 :: proc(x: f64) -> f64 { return f64(int(0 < x) - int(x < 0)); }
-sign_f64le :: proc(x: f64le) -> f64le { return f64le(int(0 < x) - int(x < 0)); }
-sign_f64be :: proc(x: f64be) -> f64be { return f64be(int(0 < x) - int(x < 0)); }
+sign_f16 :: proc(x: f16) -> f16 { return f16(int(0 < x) - int(x < 0)) }
+sign_f16le :: proc(x: f16le) -> f16le { return f16le(int(0 < x) - int(x < 0)) }
+sign_f16be :: proc(x: f16be) -> f16be { return f16be(int(0 < x) - int(x < 0)) }
+sign_f32 :: proc(x: f32) -> f32 { return f32(int(0 < x) - int(x < 0)) }
+sign_f32le :: proc(x: f32le) -> f32le { return f32le(int(0 < x) - int(x < 0)) }
+sign_f32be :: proc(x: f32be) -> f32be { return f32be(int(0 < x) - int(x < 0)) }
+sign_f64 :: proc(x: f64) -> f64 { return f64(int(0 < x) - int(x < 0)) }
+sign_f64le :: proc(x: f64le) -> f64le { return f64le(int(0 < x) - int(x < 0)) }
+sign_f64be :: proc(x: f64be) -> f64be { return f64be(int(0 < x) - int(x < 0)) }
sign :: proc{
sign_f16, sign_f16le, sign_f16be,
sign_f32, sign_f32le, sign_f32be,
@@ -329,18 +329,18 @@ sign :: proc{
sign_bit_f16 :: proc(x: f16) -> bool {
return (transmute(u16)x) & (1<<15) != 0
}
-sign_bit_f16le :: proc(x: f16le) -> bool { return #force_inline sign_bit_f16(f16(x)); }
-sign_bit_f16be :: proc(x: f16be) -> bool { return #force_inline sign_bit_f16(f16(x)); }
+sign_bit_f16le :: proc(x: f16le) -> bool { return #force_inline sign_bit_f16(f16(x)) }
+sign_bit_f16be :: proc(x: f16be) -> bool { return #force_inline sign_bit_f16(f16(x)) }
sign_bit_f32 :: proc(x: f32) -> bool {
return (transmute(u32)x) & (1<<31) != 0
}
-sign_bit_f32le :: proc(x: f32le) -> bool { return #force_inline sign_bit_f32(f32(x)); }
-sign_bit_f32be :: proc(x: f32be) -> bool { return #force_inline sign_bit_f32(f32(x)); }
+sign_bit_f32le :: proc(x: f32le) -> bool { return #force_inline sign_bit_f32(f32(x)) }
+sign_bit_f32be :: proc(x: f32be) -> bool { return #force_inline sign_bit_f32(f32(x)) }
sign_bit_f64 :: proc(x: f64) -> bool {
return (transmute(u64)x) & (1<<63) != 0
}
-sign_bit_f64le :: proc(x: f64le) -> bool { return #force_inline sign_bit_f64(f64(x)); }
-sign_bit_f64be :: proc(x: f64be) -> bool { return #force_inline sign_bit_f64(f64(x)); }
+sign_bit_f64le :: proc(x: f64le) -> bool { return #force_inline sign_bit_f64(f64(x)) }
+sign_bit_f64be :: proc(x: f64be) -> bool { return #force_inline sign_bit_f64(f64(x)) }
sign_bit :: proc{
sign_bit_f16, sign_bit_f16le, sign_bit_f16be,
sign_bit_f32, sign_bit_f32le, sign_bit_f32be,
@@ -354,8 +354,8 @@ copy_sign_f16 :: proc(x, y: f16) -> f16 {
ix |= iy & 0x8000
return transmute(f16)ix
}
-copy_sign_f16le :: proc(x, y: f16le) -> f16le { return #force_inline f16le(copy_sign_f16(f16(x), f16(y))); }
-copy_sign_f16be :: proc(x, y: f16be) -> f16be { return #force_inline f16be(copy_sign_f16(f16(x), f16(y))); }
+copy_sign_f16le :: proc(x, y: f16le) -> f16le { return #force_inline f16le(copy_sign_f16(f16(x), f16(y))) }
+copy_sign_f16be :: proc(x, y: f16be) -> f16be { return #force_inline f16be(copy_sign_f16(f16(x), f16(y))) }
copy_sign_f32 :: proc(x, y: f32) -> f32 {
ix := transmute(u32)x
iy := transmute(u32)y
@@ -363,8 +363,8 @@ copy_sign_f32 :: proc(x, y: f32) -> f32 {
ix |= iy & 0x8000_0000
return transmute(f32)ix
}
-copy_sign_f32le :: proc(x, y: f32le) -> f32le { return #force_inline f32le(copy_sign_f32(f32(x), f32(y))); }
-copy_sign_f32be :: proc(x, y: f32be) -> f32be { return #force_inline f32be(copy_sign_f32(f32(x), f32(y))); }
+copy_sign_f32le :: proc(x, y: f32le) -> f32le { return #force_inline f32le(copy_sign_f32(f32(x), f32(y))) }
+copy_sign_f32be :: proc(x, y: f32be) -> f32be { return #force_inline f32be(copy_sign_f32(f32(x), f32(y))) }
copy_sign_f64 :: proc(x, y: f64) -> f64 {
ix := transmute(u64)x
iy := transmute(u64)y
@@ -372,32 +372,32 @@ copy_sign_f64 :: proc(x, y: f64) -> f64 {
ix |= iy & 0x8000_0000_0000_0000
return transmute(f64)ix
}
-copy_sign_f64le :: proc(x, y: f64le) -> f64le { return #force_inline f64le(copy_sign_f64(f64(x), f64(y))); }
-copy_sign_f64be :: proc(x, y: f64be) -> f64be { return #force_inline f64be(copy_sign_f64(f64(x), f64(y))); }
+copy_sign_f64le :: proc(x, y: f64le) -> f64le { return #force_inline f64le(copy_sign_f64(f64(x), f64(y))) }
+copy_sign_f64be :: proc(x, y: f64be) -> f64be { return #force_inline f64be(copy_sign_f64(f64(x), f64(y))) }
copy_sign :: proc{
copy_sign_f16, copy_sign_f16le, copy_sign_f16be,
copy_sign_f32, copy_sign_f32le, copy_sign_f32be,
copy_sign_f64, copy_sign_f64le, copy_sign_f64be,
}
-to_radians_f16 :: proc(degrees: f16) -> f16 { return degrees * RAD_PER_DEG; }
-to_radians_f16le :: proc(degrees: f16le) -> f16le { return degrees * RAD_PER_DEG; }
-to_radians_f16be :: proc(degrees: f16be) -> f16be { return degrees * RAD_PER_DEG; }
-to_radians_f32 :: proc(degrees: f32) -> f32 { return degrees * RAD_PER_DEG; }
-to_radians_f32le :: proc(degrees: f32le) -> f32le { return degrees * RAD_PER_DEG; }
-to_radians_f32be :: proc(degrees: f32be) -> f32be { return degrees * RAD_PER_DEG; }
-to_radians_f64 :: proc(degrees: f64) -> f64 { return degrees * RAD_PER_DEG; }
-to_radians_f64le :: proc(degrees: f64le) -> f64le { return degrees * RAD_PER_DEG; }
-to_radians_f64be :: proc(degrees: f64be) -> f64be { return degrees * RAD_PER_DEG; }
-to_degrees_f16 :: proc(radians: f16) -> f16 { return radians * DEG_PER_RAD; }
-to_degrees_f16le :: proc(radians: f16le) -> f16le { return radians * DEG_PER_RAD; }
-to_degrees_f16be :: proc(radians: f16be) -> f16be { return radians * DEG_PER_RAD; }
-to_degrees_f32 :: proc(radians: f32) -> f32 { return radians * DEG_PER_RAD; }
-to_degrees_f32le :: proc(radians: f32le) -> f32le { return radians * DEG_PER_RAD; }
-to_degrees_f32be :: proc(radians: f32be) -> f32be { return radians * DEG_PER_RAD; }
-to_degrees_f64 :: proc(radians: f64) -> f64 { return radians * DEG_PER_RAD; }
-to_degrees_f64le :: proc(radians: f64le) -> f64le { return radians * DEG_PER_RAD; }
-to_degrees_f64be :: proc(radians: f64be) -> f64be { return radians * DEG_PER_RAD; }
+to_radians_f16 :: proc(degrees: f16) -> f16 { return degrees * RAD_PER_DEG }
+to_radians_f16le :: proc(degrees: f16le) -> f16le { return degrees * RAD_PER_DEG }
+to_radians_f16be :: proc(degrees: f16be) -> f16be { return degrees * RAD_PER_DEG }
+to_radians_f32 :: proc(degrees: f32) -> f32 { return degrees * RAD_PER_DEG }
+to_radians_f32le :: proc(degrees: f32le) -> f32le { return degrees * RAD_PER_DEG }
+to_radians_f32be :: proc(degrees: f32be) -> f32be { return degrees * RAD_PER_DEG }
+to_radians_f64 :: proc(degrees: f64) -> f64 { return degrees * RAD_PER_DEG }
+to_radians_f64le :: proc(degrees: f64le) -> f64le { return degrees * RAD_PER_DEG }
+to_radians_f64be :: proc(degrees: f64be) -> f64be { return degrees * RAD_PER_DEG }
+to_degrees_f16 :: proc(radians: f16) -> f16 { return radians * DEG_PER_RAD }
+to_degrees_f16le :: proc(radians: f16le) -> f16le { return radians * DEG_PER_RAD }
+to_degrees_f16be :: proc(radians: f16be) -> f16be { return radians * DEG_PER_RAD }
+to_degrees_f32 :: proc(radians: f32) -> f32 { return radians * DEG_PER_RAD }
+to_degrees_f32le :: proc(radians: f32le) -> f32le { return radians * DEG_PER_RAD }
+to_degrees_f32be :: proc(radians: f32be) -> f32be { return radians * DEG_PER_RAD }
+to_degrees_f64 :: proc(radians: f64) -> f64 { return radians * DEG_PER_RAD }
+to_degrees_f64le :: proc(radians: f64le) -> f64le { return radians * DEG_PER_RAD }
+to_degrees_f64be :: proc(radians: f64be) -> f64be { return radians * DEG_PER_RAD }
to_radians :: proc{
to_radians_f16, to_radians_f16le, to_radians_f16be,
to_radians_f32, to_radians_f32le, to_radians_f32be,
@@ -438,8 +438,8 @@ trunc_f16 :: proc(x: f16) -> f16 {
}
return trunc_internal(x)
}
-trunc_f16le :: proc(x: f16le) -> f16le { return #force_inline f16le(trunc_f16(f16(x))); }
-trunc_f16be :: proc(x: f16be) -> f16be { return #force_inline f16be(trunc_f16(f16(x))); }
+trunc_f16le :: proc(x: f16le) -> f16le { return #force_inline f16le(trunc_f16(f16(x))) }
+trunc_f16be :: proc(x: f16be) -> f16be { return #force_inline f16be(trunc_f16(f16(x))) }
trunc_f32 :: proc(x: f32) -> f32 {
trunc_internal :: proc(f: f32) -> f32 {
@@ -470,8 +470,8 @@ trunc_f32 :: proc(x: f32) -> f32 {
}
return trunc_internal(x)
}
-trunc_f32le :: proc(x: f32le) -> f32le { return #force_inline f32le(trunc_f32(f32(x))); }
-trunc_f32be :: proc(x: f32be) -> f32be { return #force_inline f32be(trunc_f32(f32(x))); }
+trunc_f32le :: proc(x: f32le) -> f32le { return #force_inline f32le(trunc_f32(f32(x))) }
+trunc_f32be :: proc(x: f32be) -> f32be { return #force_inline f32be(trunc_f32(f32(x))) }
trunc_f64 :: proc(x: f64) -> f64 {
trunc_internal :: proc(f: f64) -> f64 {
@@ -502,8 +502,8 @@ trunc_f64 :: proc(x: f64) -> f64 {
}
return trunc_internal(x)
}
-trunc_f64le :: proc(x: f64le) -> f64le { return #force_inline f64le(trunc_f64(f64(x))); }
-trunc_f64be :: proc(x: f64be) -> f64be { return #force_inline f64be(trunc_f64(f64(x))); }
+trunc_f64le :: proc(x: f64le) -> f64le { return #force_inline f64le(trunc_f64(f64(x))) }
+trunc_f64be :: proc(x: f64be) -> f64be { return #force_inline f64be(trunc_f64(f64(x))) }
trunc :: proc{
trunc_f16, trunc_f16le, trunc_f16be,
trunc_f32, trunc_f32le, trunc_f32be,
@@ -545,17 +545,17 @@ round :: proc{
}
-ceil_f16 :: proc(x: f16) -> f16 { return -floor(-x); }
-ceil_f16le :: proc(x: f16le) -> f16le { return -floor(-x); }
-ceil_f16be :: proc(x: f16be) -> f16be { return -floor(-x); }
+ceil_f16 :: proc(x: f16) -> f16 { return -floor(-x) }
+ceil_f16le :: proc(x: f16le) -> f16le { return -floor(-x) }
+ceil_f16be :: proc(x: f16be) -> f16be { return -floor(-x) }
-ceil_f32 :: proc(x: f32) -> f32 { return -floor(-x); }
-ceil_f32le :: proc(x: f32le) -> f32le { return -floor(-x); }
-ceil_f32be :: proc(x: f32be) -> f32be { return -floor(-x); }
+ceil_f32 :: proc(x: f32) -> f32 { return -floor(-x) }
+ceil_f32le :: proc(x: f32le) -> f32le { return -floor(-x) }
+ceil_f32be :: proc(x: f32be) -> f32be { return -floor(-x) }
-ceil_f64 :: proc(x: f64) -> f64 { return -floor(-x); }
-ceil_f64le :: proc(x: f64le) -> f64le { return -floor(-x); }
-ceil_f64be :: proc(x: f64be) -> f64be { return -floor(-x); }
+ceil_f64 :: proc(x: f64) -> f64 { return -floor(-x) }
+ceil_f64le :: proc(x: f64le) -> f64le { return -floor(-x) }
+ceil_f64be :: proc(x: f64be) -> f64be { return -floor(-x) }
ceil :: proc{
ceil_f16, ceil_f16le, ceil_f16be,
@@ -577,8 +577,8 @@ floor_f16 :: proc(x: f16) -> f16 {
d, _ := modf(x)
return d
}
-floor_f16le :: proc(x: f16le) -> f16le { return #force_inline f16le(floor_f16(f16(x))); }
-floor_f16be :: proc(x: f16be) -> f16be { return #force_inline f16be(floor_f16(f16(x))); }
+floor_f16le :: proc(x: f16le) -> f16le { return #force_inline f16le(floor_f16(f16(x))) }
+floor_f16be :: proc(x: f16be) -> f16be { return #force_inline f16be(floor_f16(f16(x))) }
floor_f32 :: proc(x: f32) -> f32 {
if x == 0 || is_nan(x) || is_inf(x) {
return x
@@ -593,8 +593,8 @@ floor_f32 :: proc(x: f32) -> f32 {
d, _ := modf(x)
return d
}
-floor_f32le :: proc(x: f32le) -> f32le { return #force_inline f32le(floor_f32(f32(x))); }
-floor_f32be :: proc(x: f32be) -> f32be { return #force_inline f32be(floor_f32(f32(x))); }
+floor_f32le :: proc(x: f32le) -> f32le { return #force_inline f32le(floor_f32(f32(x))) }
+floor_f32be :: proc(x: f32be) -> f32be { return #force_inline f32be(floor_f32(f32(x))) }
floor_f64 :: proc(x: f64) -> f64 {
if x == 0 || is_nan(x) || is_inf(x) {
return x
@@ -609,8 +609,8 @@ floor_f64 :: proc(x: f64) -> f64 {
d, _ := modf(x)
return d
}
-floor_f64le :: proc(x: f64le) -> f64le { return #force_inline f64le(floor_f64(f64(x))); }
-floor_f64be :: proc(x: f64be) -> f64be { return #force_inline f64be(floor_f64(f64(x))); }
+floor_f64le :: proc(x: f64le) -> f64le { return #force_inline f64le(floor_f64(f64(x))) }
+floor_f64be :: proc(x: f64be) -> f64be { return #force_inline f64be(floor_f64(f64(x))) }
floor :: proc{
floor_f16, floor_f16le, floor_f16be,
floor_f32, floor_f32le, floor_f32be,
@@ -754,8 +754,8 @@ mod_f16 :: proc(x, y: f16) -> (n: f16) {
}
return copy_sign(n, x)
}
-mod_f16le :: proc(x, y: f16le) -> (n: f16le) { return #force_inline f16le(mod_f16(f16(x), f16(y))); }
-mod_f16be :: proc(x, y: f16be) -> (n: f16be) { return #force_inline f16be(mod_f16(f16(x), f16(y))); }
+mod_f16le :: proc(x, y: f16le) -> (n: f16le) { return #force_inline f16le(mod_f16(f16(x), f16(y))) }
+mod_f16be :: proc(x, y: f16be) -> (n: f16be) { return #force_inline f16be(mod_f16(f16(x), f16(y))) }
mod_f32 :: proc(x, y: f32) -> (n: f32) {
z := abs(y)
n = remainder(abs(x), z)
@@ -764,8 +764,8 @@ mod_f32 :: proc(x, y: f32) -> (n: f32) {
}
return copy_sign(n, x)
}
-mod_f32le :: proc(x, y: f32le) -> (n: f32le) { return #force_inline f32le(mod_f32(f32(x), f32(y))); }
-mod_f32be :: proc(x, y: f32be) -> (n: f32be) { return #force_inline f32be(mod_f32(f32(x), f32(y))); }
+mod_f32le :: proc(x, y: f32le) -> (n: f32le) { return #force_inline f32le(mod_f32(f32(x), f32(y))) }
+mod_f32be :: proc(x, y: f32be) -> (n: f32be) { return #force_inline f32be(mod_f32(f32(x), f32(y))) }
mod_f64 :: proc(x, y: f64) -> (n: f64) {
z := abs(y)
n = remainder(abs(x), z)
@@ -774,23 +774,23 @@ mod_f64 :: proc(x, y: f64) -> (n: f64) {
}
return copy_sign(n, x)
}
-mod_f64le :: proc(x, y: f64le) -> (n: f64le) { return #force_inline f64le(mod_f64(f64(x), f64(y))); }
-mod_f64be :: proc(x, y: f64be) -> (n: f64be) { return #force_inline f64be(mod_f64(f64(x), f64(y))); }
+mod_f64le :: proc(x, y: f64le) -> (n: f64le) { return #force_inline f64le(mod_f64(f64(x), f64(y))) }
+mod_f64be :: proc(x, y: f64be) -> (n: f64be) { return #force_inline f64be(mod_f64(f64(x), f64(y))) }
mod :: proc{
mod_f16, mod_f16le, mod_f16be,
mod_f32, mod_f32le, mod_f32be,
mod_f64, mod_f64le, mod_f64be,
}
-remainder_f16 :: proc(x, y: f16 ) -> f16 { return x - round(x/y) * y; }
-remainder_f16le :: proc(x, y: f16le) -> f16le { return x - round(x/y) * y; }
-remainder_f16be :: proc(x, y: f16be) -> f16be { return x - round(x/y) * y; }
-remainder_f32 :: proc(x, y: f32 ) -> f32 { return x - round(x/y) * y; }
-remainder_f32le :: proc(x, y: f32le) -> f32le { return x - round(x/y) * y; }
-remainder_f32be :: proc(x, y: f32be) -> f32be { return x - round(x/y) * y; }
-remainder_f64 :: proc(x, y: f64 ) -> f64 { return x - round(x/y) * y; }
-remainder_f64le :: proc(x, y: f64le) -> f64le { return x - round(x/y) * y; }
-remainder_f64be :: proc(x, y: f64be) -> f64be { return x - round(x/y) * y; }
+remainder_f16 :: proc(x, y: f16 ) -> f16 { return x - round(x/y) * y }
+remainder_f16le :: proc(x, y: f16le) -> f16le { return x - round(x/y) * y }
+remainder_f16be :: proc(x, y: f16be) -> f16be { return x - round(x/y) * y }
+remainder_f32 :: proc(x, y: f32 ) -> f32 { return x - round(x/y) * y }
+remainder_f32le :: proc(x, y: f32le) -> f32le { return x - round(x/y) * y }
+remainder_f32be :: proc(x, y: f32be) -> f32be { return x - round(x/y) * y }
+remainder_f64 :: proc(x, y: f64 ) -> f64 { return x - round(x/y) * y }
+remainder_f64le :: proc(x, y: f64le) -> f64le { return x - round(x/y) * y }
+remainder_f64be :: proc(x, y: f64be) -> f64be { return x - round(x/y) * y }
remainder :: proc{
remainder_f16, remainder_f16le, remainder_f16be,
remainder_f32, remainder_f32le, remainder_f32be,
@@ -958,8 +958,8 @@ classify_f16 :: proc(x: f16) -> Float_Class {
}
return .Normal
}
-classify_f16le :: proc(x: f16le) -> Float_Class { return #force_inline classify_f16(f16(x)); }
-classify_f16be :: proc(x: f16be) -> Float_Class { return #force_inline classify_f16(f16(x)); }
+classify_f16le :: proc(x: f16le) -> Float_Class { return #force_inline classify_f16(f16(x)) }
+classify_f16be :: proc(x: f16be) -> Float_Class { return #force_inline classify_f16(f16(x)) }
classify_f32 :: proc(x: f32) -> Float_Class {
switch {
case x == 0:
@@ -984,8 +984,8 @@ classify_f32 :: proc(x: f32) -> Float_Class {
}
return .Normal
}
-classify_f32le :: proc(x: f32le) -> Float_Class { return #force_inline classify_f32(f32(x)); }
-classify_f32be :: proc(x: f32be) -> Float_Class { return #force_inline classify_f32(f32(x)); }
+classify_f32le :: proc(x: f32le) -> Float_Class { return #force_inline classify_f32(f32(x)) }
+classify_f32be :: proc(x: f32be) -> Float_Class { return #force_inline classify_f32(f32(x)) }
classify_f64 :: proc(x: f64) -> Float_Class {
switch {
case x == 0:
@@ -1009,23 +1009,23 @@ classify_f64 :: proc(x: f64) -> Float_Class {
}
return .Normal
}
-classify_f64le :: proc(x: f64le) -> Float_Class { return #force_inline classify_f64(f64(x)); }
-classify_f64be :: proc(x: f64be) -> Float_Class { return #force_inline classify_f64(f64(x)); }
+classify_f64le :: proc(x: f64le) -> Float_Class { return #force_inline classify_f64(f64(x)) }
+classify_f64be :: proc(x: f64be) -> Float_Class { return #force_inline classify_f64(f64(x)) }
classify :: proc{
classify_f16, classify_f16le, classify_f16be,
classify_f32, classify_f32le, classify_f32be,
classify_f64, classify_f64le, classify_f64be,
}
-is_nan_f16 :: proc(x: f16) -> bool { return classify(x) == .NaN; }
-is_nan_f16le :: proc(x: f16le) -> bool { return classify(x) == .NaN; }
-is_nan_f16be :: proc(x: f16be) -> bool { return classify(x) == .NaN; }
-is_nan_f32 :: proc(x: f32) -> bool { return classify(x) == .NaN; }
-is_nan_f32le :: proc(x: f32le) -> bool { return classify(x) == .NaN; }
-is_nan_f32be :: proc(x: f32be) -> bool { return classify(x) == .NaN; }
-is_nan_f64 :: proc(x: f64) -> bool { return classify(x) == .NaN; }
-is_nan_f64le :: proc(x: f64le) -> bool { return classify(x) == .NaN; }
-is_nan_f64be :: proc(x: f64be) -> bool { return classify(x) == .NaN; }
+is_nan_f16 :: proc(x: f16) -> bool { return classify(x) == .NaN }
+is_nan_f16le :: proc(x: f16le) -> bool { return classify(x) == .NaN }
+is_nan_f16be :: proc(x: f16be) -> bool { return classify(x) == .NaN }
+is_nan_f32 :: proc(x: f32) -> bool { return classify(x) == .NaN }
+is_nan_f32le :: proc(x: f32le) -> bool { return classify(x) == .NaN }
+is_nan_f32be :: proc(x: f32be) -> bool { return classify(x) == .NaN }
+is_nan_f64 :: proc(x: f64) -> bool { return classify(x) == .NaN }
+is_nan_f64le :: proc(x: f64le) -> bool { return classify(x) == .NaN }
+is_nan_f64be :: proc(x: f64be) -> bool { return classify(x) == .NaN }
is_nan :: proc{
is_nan_f16, is_nan_f16le, is_nan_f16be,
is_nan_f32, is_nan_f32le, is_nan_f32be,
diff --git a/core/math/rand/rand.odin b/core/math/rand/rand.odin
index 1a833d3ca..9bd30c216 100644
--- a/core/math/rand/rand.odin
+++ b/core/math/rand/rand.odin
@@ -43,7 +43,7 @@ _random :: proc(r: ^Rand) -> u32 {
return (xor_shifted >> rot) | (xor_shifted << ((-rot) & 31))
}
-uint32 :: proc(r: ^Rand = nil) -> u32 { return _random(r); }
+uint32 :: proc(r: ^Rand = nil) -> u32 { return _random(r) }
uint64 :: proc(r: ^Rand = nil) -> u64 {
a := u64(_random(r))
@@ -59,9 +59,9 @@ uint128 :: proc(r: ^Rand = nil) -> u128 {
return (a<<96) | (b<<64) | (c<<32) | d
}
-int31 :: proc(r: ^Rand = nil) -> i32 { return i32(uint32(r) << 1 >> 1); }
-int63 :: proc(r: ^Rand = nil) -> i64 { return i64(uint64(r) << 1 >> 1); }
-int127 :: proc(r: ^Rand = nil) -> i128 { return i128(uint128(r) << 1 >> 1); }
+int31 :: proc(r: ^Rand = nil) -> i32 { return i32(uint32(r) << 1 >> 1) }
+int63 :: proc(r: ^Rand = nil) -> i64 { return i64(uint64(r) << 1 >> 1) }
+int127 :: proc(r: ^Rand = nil) -> i128 { return i128(uint128(r) << 1 >> 1) }
int31_max :: proc(n: i32, r: ^Rand = nil) -> i32 {
if n <= 0 {
@@ -119,11 +119,11 @@ int_max :: proc(n: int, r: ^Rand = nil) -> int {
}
}
-float64 :: proc(r: ^Rand = nil) -> f64 { return f64(int63_max(1<<53, r)) / (1 << 53); }
-float32 :: proc(r: ^Rand = nil) -> f32 { return f32(float64(r)); }
+float64 :: proc(r: ^Rand = nil) -> f64 { return f64(int63_max(1<<53, r)) / (1 << 53) }
+float32 :: proc(r: ^Rand = nil) -> f32 { return f32(float64(r)) }
-float64_range :: proc(lo, hi: f64, r: ^Rand = nil) -> f64 { return (hi-lo)*float64(r) + lo; }
-float32_range :: proc(lo, hi: f32, r: ^Rand = nil) -> f32 { return (hi-lo)*float32(r) + lo; }
+float64_range :: proc(lo, hi: f64, r: ^Rand = nil) -> f64 { return (hi-lo)*float64(r) + lo }
+float32_range :: proc(lo, hi: f32, r: ^Rand = nil) -> f32 { return (hi-lo)*float32(r) + lo }
read :: proc(p: []byte, r: ^Rand = nil) -> (n: int) {
diff --git a/core/mem/mem.odin b/core/mem/mem.odin
index 57ab943c2..d7ff949e2 100644
--- a/core/mem/mem.odin
+++ b/core/mem/mem.odin
@@ -184,10 +184,10 @@ any_to_bytes :: proc(val: any) -> []byte {
}
-kilobytes :: proc(x: int) -> int { return (x) * 1024; }
-megabytes :: proc(x: int) -> int { return kilobytes(x) * 1024; }
-gigabytes :: proc(x: int) -> int { return megabytes(x) * 1024; }
-terabytes :: proc(x: int) -> int { return gigabytes(x) * 1024; }
+kilobytes :: proc(x: int) -> int { return (x) * 1024 }
+megabytes :: proc(x: int) -> int { return kilobytes(x) * 1024 }
+gigabytes :: proc(x: int) -> int { return megabytes(x) * 1024 }
+terabytes :: proc(x: int) -> int { return gigabytes(x) * 1024 }
is_power_of_two :: proc(x: uintptr) -> bool {
if x <= 0 {
diff --git a/core/odin/parser/parser.odin b/core/odin/parser/parser.odin
index 3053f2255..af81b9041 100644
--- a/core/odin/parser/parser.odin
+++ b/core/odin/parser/parser.odin
@@ -1051,13 +1051,13 @@ parse_attribute :: proc(p: ^Parser, tok: tokenizer.Token, open_kind, close_kind:
decl := parse_stmt(p)
switch d in &decl.derived {
case ast.Value_Decl:
- if d.docs == nil { d.docs = docs; }
+ if d.docs == nil { d.docs = docs }
append(&d.attributes, attribute)
case ast.Foreign_Block_Decl:
- if d.docs == nil { d.docs = docs; }
+ if d.docs == nil { d.docs = docs }
append(&d.attributes, attribute)
case ast.Foreign_Import_Decl:
- if d.docs == nil { d.docs = docs; }
+ if d.docs == nil { d.docs = docs }
append(&d.attributes, attribute)
case:
error(p, decl.pos, "expected a value or foreign declaration after an attribute")
@@ -1693,20 +1693,20 @@ parse_field_prefixes :: proc(p: ^Parser) -> ast.Field_Flags {
switch kind {
case .Invalid, .Unknown: // Ignore
case .Using:
- if count > 1 { error(p, p.curr_tok.pos, "multiple 'using' in this field list"); }
- if count > 0 { flags += {.Using}; }
+ if count > 1 { error(p, p.curr_tok.pos, "multiple 'using' in this field list") }
+ if count > 0 { flags += {.Using} }
case .No_Alias:
- if count > 1 { error(p, p.curr_tok.pos, "multiple '#no_alias' in this field list"); }
- if count > 0 { flags += {.No_Alias}; }
+ if count > 1 { error(p, p.curr_tok.pos, "multiple '#no_alias' in this field list") }
+ if count > 0 { flags += {.No_Alias} }
case .C_Vararg:
- if count > 1 { error(p, p.curr_tok.pos, "multiple '#c_vararg' in this field list"); }
- if count > 0 { flags += {.C_Vararg}; }
+ if count > 1 { error(p, p.curr_tok.pos, "multiple '#c_vararg' in this field list") }
+ if count > 0 { flags += {.C_Vararg} }
case .Auto_Cast:
- if count > 1 { error(p, p.curr_tok.pos, "multiple 'auto_cast' in this field list"); }
- if count > 0 { flags += {.Auto_Cast}; }
+ if count > 1 { error(p, p.curr_tok.pos, "multiple 'auto_cast' in this field list") }
+ if count > 0 { flags += {.Auto_Cast} }
case .Any_Int:
- if count > 1 { error(p, p.curr_tok.pos, "multiple '#any_int' in this field list"); }
- if count > 0 { flags += {.Any_Int}; }
+ if count > 1 { error(p, p.curr_tok.pos, "multiple '#any_int' in this field list") }
+ if count > 0 { flags += {.Any_Int} }
}
}
diff --git a/core/os/stat_windows.odin b/core/os/stat_windows.odin
index d7181f089..48f193cdb 100644
--- a/core/os/stat_windows.odin
+++ b/core/os/stat_windows.odin
@@ -108,7 +108,7 @@ cleanpath_strip_prefix :: proc(buf: []u16) -> []u16 {
buf := buf
N := 0
for c, i in buf {
- if c == 0 { break; }
+ if c == 0 { break }
N = i+1
}
buf = buf[:N]
diff --git a/core/reflect/reflect.odin b/core/reflect/reflect.odin
index ed653b6b1..7c5d851b4 100644
--- a/core/reflect/reflect.odin
+++ b/core/reflect/reflect.odin
@@ -117,7 +117,7 @@ backing_type_kind :: proc(T: typeid) -> Type_Kind {
type_info_base :: proc(info: ^Type_Info) -> ^Type_Info {
- if info == nil { return nil; }
+ if info == nil { return nil }
base := info
loop: for {
@@ -131,7 +131,7 @@ type_info_base :: proc(info: ^Type_Info) -> ^Type_Info {
type_info_core :: proc(info: ^Type_Info) -> ^Type_Info {
- if info == nil { return nil; }
+ if info == nil { return nil }
base := info
loop: for {
@@ -159,7 +159,7 @@ typeid_base_without_enum :: typeid_core
typeid_elem :: proc(id: typeid) -> typeid {
ti := type_info_of(id)
- if ti == nil { return nil; }
+ if ti == nil { return nil }
bits := 8*ti.size
@@ -228,7 +228,7 @@ is_nil :: proc(v: any) -> bool {
}
length :: proc(val: any) -> int {
- if val == nil { return 0; }
+ if val == nil { return 0 }
#partial switch a in type_info_of(val.id).variant {
case Type_Info_Named:
@@ -263,7 +263,7 @@ length :: proc(val: any) -> int {
}
capacity :: proc(val: any) -> int {
- if val == nil { return 0; }
+ if val == nil { return 0 }
#partial switch a in type_info_of(val.id).variant {
case Type_Info_Named:
@@ -289,7 +289,7 @@ capacity :: proc(val: any) -> int {
index :: proc(val: any, i: int, loc := #caller_location) -> any {
- if val == nil { return nil; }
+ if val == nil { return nil }
#partial switch a in type_info_of(val.id).variant {
case Type_Info_Named:
@@ -336,7 +336,7 @@ index :: proc(val: any, i: int, loc := #caller_location) -> any {
return any{data, a.elem.id}
case Type_Info_String:
- if a.is_cstring { return nil; }
+ if a.is_cstring { return nil }
raw := (^mem.Raw_String)(val.data)
runtime.bounds_check_error_loc(loc, i, raw.len)
@@ -395,7 +395,7 @@ struct_field_by_name :: proc(T: typeid, name: string) -> (field: Struct_Field) {
}
struct_field_value_by_name :: proc(a: any, field: string, allow_using := false) -> any {
- if a == nil { return nil; }
+ if a == nil { return nil }
ti := runtime.type_info_base(type_info_of(a.id))
@@ -538,7 +538,7 @@ struct_tag_lookup :: proc(tag: Struct_Tag, key: string) -> (value: Struct_Tag, o
enum_string :: proc(a: any) -> string {
- if a == nil { return ""; }
+ if a == nil { return "" }
ti := runtime.type_info_base(type_info_of(a.id))
if e, ok := ti.variant.(runtime.Type_Info_Enum); ok {
v, _ := as_i64(a)
@@ -627,7 +627,7 @@ type_info_union_is_pure_maybe :: proc(info: runtime.Type_Info_Union) -> bool {
}
union_variant_typeid :: proc(a: any) -> typeid {
- if a == nil { return nil; }
+ if a == nil { return nil }
ti := runtime.type_info_base(type_info_of(a.id))
if info, ok := ti.variant.(runtime.Type_Info_Union); ok {
@@ -666,7 +666,7 @@ union_variant_typeid :: proc(a: any) -> typeid {
}
get_union_variant_raw_tag :: proc(a: any) -> i64 {
- if a == nil { return -1; }
+ if a == nil { return -1 }
ti := runtime.type_info_base(type_info_of(a.id))
if info, ok := ti.variant.(runtime.Type_Info_Union); ok {
@@ -697,7 +697,7 @@ get_union_variant_raw_tag :: proc(a: any) -> i64 {
set_union_variant_raw_tag :: proc(a: any, tag: i64) {
- if a == nil { return; }
+ if a == nil { return }
ti := runtime.type_info_base(type_info_of(a.id))
if info, ok := ti.variant.(runtime.Type_Info_Union); ok {
@@ -727,7 +727,7 @@ set_union_variant_raw_tag :: proc(a: any, tag: i64) {
}
set_union_variant_typeid :: proc(a: any, id: typeid) {
- if a == nil { return; }
+ if a == nil { return }
ti := runtime.type_info_base(type_info_of(a.id))
if info, ok := ti.variant.(runtime.Type_Info_Union); ok {
@@ -757,7 +757,7 @@ set_union_variant_typeid :: proc(a: any, id: typeid) {
}
set_union_variant_type_info :: proc(a: any, tag_ti: ^Type_Info) {
- if a == nil { return; }
+ if a == nil { return }
ti := runtime.type_info_base(type_info_of(a.id))
if info, ok := ti.variant.(runtime.Type_Info_Union); ok {
@@ -788,7 +788,7 @@ set_union_variant_type_info :: proc(a: any, tag_ti: ^Type_Info) {
as_bool :: proc(a: any) -> (value: bool, valid: bool) {
- if a == nil { return; }
+ if a == nil { return }
a := a
ti := runtime.type_info_core(type_info_of(a.id))
a.id = ti.id
@@ -824,7 +824,7 @@ as_uint :: proc(a: any) -> (value: uint, valid: bool) {
}
as_i64 :: proc(a: any) -> (value: i64, valid: bool) {
- if a == nil { return; }
+ if a == nil { return }
a := a
ti := runtime.type_info_core(type_info_of(a.id))
a.id = ti.id
@@ -931,7 +931,7 @@ as_i64 :: proc(a: any) -> (value: i64, valid: bool) {
}
as_u64 :: proc(a: any) -> (value: u64, valid: bool) {
- if a == nil { return; }
+ if a == nil { return }
a := a
ti := runtime.type_info_core(type_info_of(a.id))
a.id = ti.id
@@ -1039,7 +1039,7 @@ as_u64 :: proc(a: any) -> (value: u64, valid: bool) {
as_f64 :: proc(a: any) -> (value: f64, valid: bool) {
- if a == nil { return; }
+ if a == nil { return }
a := a
ti := runtime.type_info_core(type_info_of(a.id))
a.id = ti.id
@@ -1144,7 +1144,7 @@ as_f64 :: proc(a: any) -> (value: f64, valid: bool) {
as_string :: proc(a: any) -> (value: string, valid: bool) {
- if a == nil { return; }
+ if a == nil { return }
a := a
ti := runtime.type_info_core(type_info_of(a.id))
a.id = ti.id
@@ -1163,7 +1163,7 @@ as_string :: proc(a: any) -> (value: string, valid: bool) {
}
relative_pointer_to_absolute :: proc(a: any) -> rawptr {
- if a == nil { return nil; }
+ if a == nil { return nil }
a := a
ti := runtime.type_info_core(type_info_of(a.id))
a.id = ti.id
@@ -1219,7 +1219,7 @@ relative_pointer_to_absolute_raw :: proc(data: rawptr, base_integer_id: typeid)
as_pointer :: proc(a: any) -> (value: rawptr, valid: bool) {
- if a == nil { return; }
+ if a == nil { return }
a := a
ti := runtime.type_info_core(type_info_of(a.id))
a.id = ti.id
@@ -1246,7 +1246,7 @@ as_pointer :: proc(a: any) -> (value: rawptr, valid: bool) {
as_raw_data :: proc(a: any) -> (value: rawptr, valid: bool) {
- if a == nil { return; }
+ if a == nil { return }
a := a
ti := runtime.type_info_core(type_info_of(a.id))
a.id = ti.id
diff --git a/core/reflect/types.odin b/core/reflect/types.odin
index 3c4ccadf8..56e9db021 100644
--- a/core/reflect/types.odin
+++ b/core/reflect/types.odin
@@ -80,12 +80,12 @@ are_types_identical :: proc(a, b: ^Type_Info) -> bool {
case Type_Info_Array:
y := b.variant.(Type_Info_Array) or_return
- if x.count != y.count { return false; }
+ if x.count != y.count { return false }
return are_types_identical(x.elem, y.elem)
case Type_Info_Enumerated_Array:
y := b.variant.(Type_Info_Enumerated_Array) or_return
- if x.count != y.count { return false; }
+ if x.count != y.count { return false }
return are_types_identical(x.index, y.index) &&
are_types_identical(x.elem, y.elem)
@@ -99,7 +99,7 @@ are_types_identical :: proc(a, b: ^Type_Info) -> bool {
case Type_Info_Tuple:
y := b.variant.(Type_Info_Tuple) or_return
- if len(x.types) != len(y.types) { return false; }
+ if len(x.types) != len(y.types) { return false }
for _, i in x.types {
xt, yt := x.types[i], y.types[i]
if !are_types_identical(xt, yt) {
@@ -125,19 +125,19 @@ are_types_identical :: proc(a, b: ^Type_Info) -> bool {
xt, yt := x.types[i], y.types[i]
xl, yl := x.tags[i], y.tags[i]
- if xn != yn { return false; }
- if !are_types_identical(xt, yt) { return false; }
- if xl != yl { return false; }
+ if xn != yn { return false }
+ if !are_types_identical(xt, yt) { return false }
+ if xl != yl { return false }
}
return true
case Type_Info_Union:
y := b.variant.(Type_Info_Union) or_return
- if len(x.variants) != len(y.variants) { return false; }
+ if len(x.variants) != len(y.variants) { return false }
for _, i in x.variants {
xv, yv := x.variants[i], y.variants[i]
- if !are_types_identical(xv, yv) { return false; }
+ if !are_types_identical(xv, yv) { return false }
}
return true
@@ -170,7 +170,7 @@ are_types_identical :: proc(a, b: ^Type_Info) -> bool {
}
is_signed :: proc(info: ^Type_Info) -> bool {
- if info == nil { return false; }
+ if info == nil { return false }
#partial switch i in type_info_base(info).variant {
case Type_Info_Integer: return i.signed
case Type_Info_Float: return true
@@ -178,7 +178,7 @@ is_signed :: proc(info: ^Type_Info) -> bool {
return false
}
is_unsigned :: proc(info: ^Type_Info) -> bool {
- if info == nil { return false; }
+ if info == nil { return false }
#partial switch i in type_info_base(info).variant {
case Type_Info_Integer: return !i.signed
case Type_Info_Float: return false
@@ -187,7 +187,7 @@ is_unsigned :: proc(info: ^Type_Info) -> bool {
}
is_byte :: proc(info: ^Type_Info) -> bool {
- if info == nil { return false; }
+ if info == nil { return false }
#partial switch i in type_info_base(info).variant {
case Type_Info_Integer: return info.size == 1
}
@@ -196,127 +196,127 @@ is_byte :: proc(info: ^Type_Info) -> bool {
is_integer :: proc(info: ^Type_Info) -> bool {
- if info == nil { return false; }
+ if info == nil { return false }
_, ok := type_info_base(info).variant.(Type_Info_Integer)
return ok
}
is_rune :: proc(info: ^Type_Info) -> bool {
- if info == nil { return false; }
+ if info == nil { return false }
_, ok := type_info_base(info).variant.(Type_Info_Rune)
return ok
}
is_float :: proc(info: ^Type_Info) -> bool {
- if info == nil { return false; }
+ if info == nil { return false }
_, ok := type_info_base(info).variant.(Type_Info_Float)
return ok
}
is_complex :: proc(info: ^Type_Info) -> bool {
- if info == nil { return false; }
+ if info == nil { return false }
_, ok := type_info_base(info).variant.(Type_Info_Complex)
return ok
}
is_quaternion :: proc(info: ^Type_Info) -> bool {
- if info == nil { return false; }
+ if info == nil { return false }
_, ok := type_info_base(info).variant.(Type_Info_Quaternion)
return ok
}
is_any :: proc(info: ^Type_Info) -> bool {
- if info == nil { return false; }
+ if info == nil { return false }
_, ok := type_info_base(info).variant.(Type_Info_Any)
return ok
}
is_string :: proc(info: ^Type_Info) -> bool {
- if info == nil { return false; }
+ if info == nil { return false }
_, ok := type_info_base(info).variant.(Type_Info_String)
return ok
}
is_cstring :: proc(info: ^Type_Info) -> bool {
- if info == nil { return false; }
+ if info == nil { return false }
v, ok := type_info_base(info).variant.(Type_Info_String)
return ok && v.is_cstring
}
is_boolean :: proc(info: ^Type_Info) -> bool {
- if info == nil { return false; }
+ if info == nil { return false }
_, ok := type_info_base(info).variant.(Type_Info_Boolean)
return ok
}
is_pointer :: proc(info: ^Type_Info) -> bool {
- if info == nil { return false; }
+ if info == nil { return false }
_, ok := type_info_base(info).variant.(Type_Info_Pointer)
return ok
}
is_multi_pointer :: proc(info: ^Type_Info) -> bool {
- if info == nil { return false; }
+ if info == nil { return false }
_, ok := type_info_base(info).variant.(Type_Info_Multi_Pointer)
return ok
}
is_procedure :: proc(info: ^Type_Info) -> bool {
- if info == nil { return false; }
+ if info == nil { return false }
_, ok := type_info_base(info).variant.(Type_Info_Procedure)
return ok
}
is_array :: proc(info: ^Type_Info) -> bool {
- if info == nil { return false; }
+ if info == nil { return false }
_, ok := type_info_base(info).variant.(Type_Info_Array)
return ok
}
is_enumerated_array :: proc(info: ^Type_Info) -> bool {
- if info == nil { return false; }
+ if info == nil { return false }
_, ok := type_info_base(info).variant.(Type_Info_Enumerated_Array)
return ok
}
is_dynamic_array :: proc(info: ^Type_Info) -> bool {
- if info == nil { return false; }
+ if info == nil { return false }
_, ok := type_info_base(info).variant.(Type_Info_Dynamic_Array)
return ok
}
is_dynamic_map :: proc(info: ^Type_Info) -> bool {
- if info == nil { return false; }
+ if info == nil { return false }
_, ok := type_info_base(info).variant.(Type_Info_Map)
return ok
}
is_slice :: proc(info: ^Type_Info) -> bool {
- if info == nil { return false; }
+ if info == nil { return false }
_, ok := type_info_base(info).variant.(Type_Info_Slice)
return ok
}
is_tuple :: proc(info: ^Type_Info) -> bool {
- if info == nil { return false; }
+ if info == nil { return false }
_, ok := type_info_base(info).variant.(Type_Info_Tuple)
return ok
}
is_struct :: proc(info: ^Type_Info) -> bool {
- if info == nil { return false; }
+ if info == nil { return false }
s, ok := type_info_base(info).variant.(Type_Info_Struct)
return ok && !s.is_raw_union
}
is_raw_union :: proc(info: ^Type_Info) -> bool {
- if info == nil { return false; }
+ if info == nil { return false }
s, ok := type_info_base(info).variant.(Type_Info_Struct)
return ok && s.is_raw_union
}
is_union :: proc(info: ^Type_Info) -> bool {
- if info == nil { return false; }
+ if info == nil { return false }
_, ok := type_info_base(info).variant.(Type_Info_Union)
return ok
}
is_enum :: proc(info: ^Type_Info) -> bool {
- if info == nil { return false; }
+ if info == nil { return false }
_, ok := type_info_base(info).variant.(Type_Info_Enum)
return ok
}
is_simd_vector :: proc(info: ^Type_Info) -> bool {
- if info == nil { return false; }
+ if info == nil { return false }
_, ok := type_info_base(info).variant.(Type_Info_Simd_Vector)
return ok
}
is_relative_pointer :: proc(info: ^Type_Info) -> bool {
- if info == nil { return false; }
+ if info == nil { return false }
_, ok := type_info_base(info).variant.(Type_Info_Relative_Pointer)
return ok
}
is_relative_slice :: proc(info: ^Type_Info) -> bool {
- if info == nil { return false; }
+ if info == nil { return false }
_, ok := type_info_base(info).variant.(Type_Info_Relative_Slice)
return ok
}
@@ -354,8 +354,8 @@ write_type_writer :: proc(w: io.Writer, ti: ^Type_Info) -> (n: int) {
return write_string(w, "nil")
}
- _n1 :: proc(err: io.Error) -> int { return 1 if err == nil else 0; }
- _n2 :: proc(n: int, _: io.Error) -> int { return n; }
+ _n1 :: proc(err: io.Error) -> int { return 1 if err == nil else 0 }
+ _n2 :: proc(n: int, _: io.Error) -> int { return n }
_n :: proc{_n1, _n2}
switch info in ti.variant {
@@ -441,9 +441,9 @@ write_type_writer :: proc(w: io.Writer, ti: ^Type_Info) -> (n: int) {
}
case Type_Info_Tuple:
count := len(info.names)
- if count != 1 { n += write_string(w, "("); }
+ if count != 1 { n += write_string(w, "(") }
for name, i in info.names {
- if i > 0 { n += write_string(w, ", "); }
+ if i > 0 { n += write_string(w, ", ") }
t := info.types[i]
@@ -453,7 +453,7 @@ write_type_writer :: proc(w: io.Writer, ti: ^Type_Info) -> (n: int) {
}
n += write_type(w, t)
}
- if count != 1 { n += write_string(w, ")"); }
+ if count != 1 { n += write_string(w, ")") }
case Type_Info_Array:
n += _n(io.write_string(w, "["))
@@ -500,8 +500,8 @@ write_type_writer :: proc(w: io.Writer, ti: ^Type_Info) -> (n: int) {
}
n += write_string(w, "struct ")
- if info.is_packed { n += write_string(w, "#packed "); }
- if info.is_raw_union { n += write_string(w, "#raw_union "); }
+ if info.is_packed { n += write_string(w, "#packed ") }
+ if info.is_raw_union { n += write_string(w, "#raw_union ") }
if info.custom_align {
n += _n(io.write_string(w, "#align "))
n += _n(io.write_i64(w, i64(ti.align), 10))
@@ -509,7 +509,7 @@ write_type_writer :: proc(w: io.Writer, ti: ^Type_Info) -> (n: int) {
}
n += _n(io.write_byte(w, '{'))
for name, i in info.names {
- if i > 0 { n += write_string(w, ", "); }
+ if i > 0 { n += write_string(w, ", ") }
n += _n(io.write_string(w, name))
n += _n(io.write_string(w, ": "))
n += write_type(w, info.types[i])
@@ -525,7 +525,7 @@ write_type_writer :: proc(w: io.Writer, ti: ^Type_Info) -> (n: int) {
}
n += _n(io.write_byte(w, '{'))
for variant, i in info.variants {
- if i > 0 { n += write_string(w, ", "); }
+ if i > 0 { n += write_string(w, ", ") }
n += write_type(w, variant)
}
n += _n(io.write_byte(w, '}'))
@@ -535,7 +535,7 @@ write_type_writer :: proc(w: io.Writer, ti: ^Type_Info) -> (n: int) {
n += write_type(w, info.base)
n += write_string(w, " {")
for name, i in info.names {
- if i > 0 { n += write_string(w, ", "); }
+ if i > 0 { n += write_string(w, ", ") }
n += write_string(w, name)
}
n += _n(io.write_byte(w, '}'))
diff --git a/core/runtime/dynamic_map_internal.odin b/core/runtime/dynamic_map_internal.odin
index 9d8604bc0..36265c03e 100644
--- a/core/runtime/dynamic_map_internal.odin
+++ b/core/runtime/dynamic_map_internal.odin
@@ -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 #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_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
diff --git a/core/runtime/internal.odin b/core/runtime/internal.odin
index 912ca9d84..139d8d666 100644
--- a/core/runtime/internal.odin
+++ b/core/runtime/internal.odin
@@ -275,11 +275,11 @@ string_cmp :: proc "contextless" (a, b: string) -> int {
return memory_compare(x.data, y.data, min(x.len, y.len))
}
-string_ne :: #force_inline proc "contextless" (a, b: string) -> bool { return !string_eq(a, b); }
-string_lt :: #force_inline proc "contextless" (a, b: string) -> bool { return string_cmp(a, b) < 0; }
-string_gt :: #force_inline proc "contextless" (a, b: string) -> bool { return string_cmp(a, b) > 0; }
-string_le :: #force_inline proc "contextless" (a, b: string) -> bool { return string_cmp(a, b) <= 0; }
-string_ge :: #force_inline proc "contextless" (a, b: string) -> bool { return string_cmp(a, b) >= 0; }
+string_ne :: #force_inline proc "contextless" (a, b: string) -> bool { return !string_eq(a, b) }
+string_lt :: #force_inline proc "contextless" (a, b: string) -> bool { return string_cmp(a, b) < 0 }
+string_gt :: #force_inline proc "contextless" (a, b: string) -> bool { return string_cmp(a, b) > 0 }
+string_le :: #force_inline proc "contextless" (a, b: string) -> bool { return string_cmp(a, b) <= 0 }
+string_ge :: #force_inline proc "contextless" (a, b: string) -> bool { return string_cmp(a, b) >= 0 }
cstring_len :: proc "contextless" (s: cstring) -> int {
p0 := uintptr((^byte)(s))
@@ -300,24 +300,24 @@ cstring_to_string :: proc "contextless" (s: cstring) -> string {
}
-complex32_eq :: #force_inline proc "contextless" (a, b: complex32) -> bool { return real(a) == real(b) && imag(a) == imag(b); }
-complex32_ne :: #force_inline proc "contextless" (a, b: complex32) -> bool { return real(a) != real(b) || imag(a) != imag(b); }
+complex32_eq :: #force_inline proc "contextless" (a, b: complex32) -> bool { return real(a) == real(b) && imag(a) == imag(b) }
+complex32_ne :: #force_inline proc "contextless" (a, b: complex32) -> bool { return real(a) != real(b) || imag(a) != imag(b) }
-complex64_eq :: #force_inline proc "contextless" (a, b: complex64) -> bool { return real(a) == real(b) && imag(a) == imag(b); }
-complex64_ne :: #force_inline proc "contextless" (a, b: complex64) -> bool { return real(a) != real(b) || imag(a) != imag(b); }
+complex64_eq :: #force_inline proc "contextless" (a, b: complex64) -> bool { return real(a) == real(b) && imag(a) == imag(b) }
+complex64_ne :: #force_inline proc "contextless" (a, b: complex64) -> bool { return real(a) != real(b) || imag(a) != imag(b) }
-complex128_eq :: #force_inline proc "contextless" (a, b: complex128) -> bool { return real(a) == real(b) && imag(a) == imag(b); }
-complex128_ne :: #force_inline proc "contextless" (a, b: complex128) -> bool { return real(a) != real(b) || imag(a) != imag(b); }
+complex128_eq :: #force_inline proc "contextless" (a, b: complex128) -> bool { return real(a) == real(b) && imag(a) == imag(b) }
+complex128_ne :: #force_inline proc "contextless" (a, b: complex128) -> bool { return real(a) != real(b) || imag(a) != imag(b) }
-quaternion64_eq :: #force_inline proc "contextless" (a, b: quaternion64) -> bool { return real(a) == real(b) && imag(a) == imag(b) && jmag(a) == jmag(b) && kmag(a) == kmag(b); }
-quaternion64_ne :: #force_inline proc "contextless" (a, b: quaternion64) -> bool { return real(a) != real(b) || imag(a) != imag(b) || jmag(a) != jmag(b) || kmag(a) != kmag(b); }
+quaternion64_eq :: #force_inline proc "contextless" (a, b: quaternion64) -> bool { return real(a) == real(b) && imag(a) == imag(b) && jmag(a) == jmag(b) && kmag(a) == kmag(b) }
+quaternion64_ne :: #force_inline proc "contextless" (a, b: quaternion64) -> bool { return real(a) != real(b) || imag(a) != imag(b) || jmag(a) != jmag(b) || kmag(a) != kmag(b) }
-quaternion128_eq :: #force_inline proc "contextless" (a, b: quaternion128) -> bool { return real(a) == real(b) && imag(a) == imag(b) && jmag(a) == jmag(b) && kmag(a) == kmag(b); }
-quaternion128_ne :: #force_inline proc "contextless" (a, b: quaternion128) -> bool { return real(a) != real(b) || imag(a) != imag(b) || jmag(a) != jmag(b) || kmag(a) != kmag(b); }
+quaternion128_eq :: #force_inline proc "contextless" (a, b: quaternion128) -> bool { return real(a) == real(b) && imag(a) == imag(b) && jmag(a) == jmag(b) && kmag(a) == kmag(b) }
+quaternion128_ne :: #force_inline proc "contextless" (a, b: quaternion128) -> bool { return real(a) != real(b) || imag(a) != imag(b) || jmag(a) != jmag(b) || kmag(a) != kmag(b) }
-quaternion256_eq :: #force_inline proc "contextless" (a, b: quaternion256) -> bool { return real(a) == real(b) && imag(a) == imag(b) && jmag(a) == jmag(b) && kmag(a) == kmag(b); }
-quaternion256_ne :: #force_inline proc "contextless" (a, b: quaternion256) -> bool { return real(a) != real(b) || imag(a) != imag(b) || jmag(a) != jmag(b) || kmag(a) != kmag(b); }
+quaternion256_eq :: #force_inline proc "contextless" (a, b: quaternion256) -> bool { return real(a) == real(b) && imag(a) == imag(b) && jmag(a) == jmag(b) && kmag(a) == kmag(b) }
+quaternion256_ne :: #force_inline proc "contextless" (a, b: quaternion256) -> bool { return real(a) != real(b) || imag(a) != imag(b) || jmag(a) != jmag(b) || kmag(a) != kmag(b) }
string_decode_rune :: #force_inline proc "contextless" (s: string) -> (rune, int) {
diff --git a/core/runtime/print.odin b/core/runtime/print.odin
index 717a3018d..07fc87fe6 100644
--- a/core/runtime/print.odin
+++ b/core/runtime/print.odin
@@ -214,7 +214,7 @@ print_type :: proc "contextless" (ti: ^Type_Info) {
t := info.params.variant.(Type_Info_Tuple)
print_byte('(')
for t, i in t.types {
- if i > 0 { print_string(", "); }
+ if i > 0 { print_string(", ") }
print_type(t)
}
print_string(")")
@@ -225,9 +225,9 @@ print_type :: proc "contextless" (ti: ^Type_Info) {
}
case Type_Info_Tuple:
count := len(info.names)
- if count != 1 { print_byte('('); }
+ if count != 1 { print_byte('(') }
for name, i in info.names {
- if i > 0 { print_string(", "); }
+ if i > 0 { print_string(", ") }
t := info.types[i]
@@ -237,7 +237,7 @@ print_type :: proc "contextless" (ti: ^Type_Info) {
}
print_type(t)
}
- if count != 1 { print_string(")"); }
+ if count != 1 { print_string(")") }
case Type_Info_Array:
print_byte('[')
@@ -285,8 +285,8 @@ print_type :: proc "contextless" (ti: ^Type_Info) {
}
print_string("struct ")
- if info.is_packed { print_string("#packed "); }
- if info.is_raw_union { print_string("#raw_union "); }
+ if info.is_packed { print_string("#packed ") }
+ if info.is_raw_union { print_string("#raw_union ") }
if info.custom_align {
print_string("#align ")
print_u64(u64(ti.align))
@@ -294,7 +294,7 @@ print_type :: proc "contextless" (ti: ^Type_Info) {
}
print_byte('{')
for name, i in info.names {
- if i > 0 { print_string(", "); }
+ if i > 0 { print_string(", ") }
print_string(name)
print_string(": ")
print_type(info.types[i])
@@ -312,7 +312,7 @@ print_type :: proc "contextless" (ti: ^Type_Info) {
}
print_byte('{')
for variant, i in info.variants {
- if i > 0 { print_string(", "); }
+ if i > 0 { print_string(", ") }
print_type(variant)
}
print_string("}")
@@ -322,7 +322,7 @@ print_type :: proc "contextless" (ti: ^Type_Info) {
print_type(info.base)
print_string(" {")
for name, i in info.names {
- if i > 0 { print_string(", "); }
+ if i > 0 { print_string(", ") }
print_string(name)
}
print_string("}")
diff --git a/core/sort/sort.odin b/core/sort/sort.odin
index 3ece4cac4..b79b2c13f 100644
--- a/core/sort/sort.odin
+++ b/core/sort/sort.odin
@@ -367,8 +367,8 @@ quick_sort_proc :: proc(array: $A/[]$T, f: proc(T, T) -> int) {
i, j := 0, n-1
loop: for {
- for f(a[i], p) < 0 { i += 1; }
- for f(p, a[j]) < 0 { j -= 1; }
+ for f(a[i], p) < 0 { i += 1 }
+ for f(p, a[j]) < 0 { j -= 1 }
if i >= j {
break loop
@@ -395,8 +395,8 @@ quick_sort :: proc(array: $A/[]$T) where intrinsics.type_is_ordered(T) {
i, j := 0, n-1
loop: for {
- for a[i] < p { i += 1; }
- for p < a[j] { j -= 1; }
+ for a[i] < p { i += 1 }
+ for p < a[j] { j -= 1 }
if i >= j {
break loop
diff --git a/core/strconv/decimal/decimal.odin b/core/strconv/decimal/decimal.odin
index eddcef001..57bb6a482 100644
--- a/core/strconv/decimal/decimal.odin
+++ b/core/strconv/decimal/decimal.odin
@@ -202,7 +202,7 @@ shift :: proc(a: ^Decimal, i: int) {
}
can_round_up :: proc(a: ^Decimal, nd: int) -> bool {
- if nd < 0 || nd >= a.count { return false ; }
+ if nd < 0 || nd >= a.count { return false }
if a.digits[nd] == '5' && nd+1 == a.count {
if a.trunc {
return true
@@ -214,7 +214,7 @@ can_round_up :: proc(a: ^Decimal, nd: int) -> bool {
}
round :: proc(a: ^Decimal, nd: int) {
- if nd < 0 || nd >= a.count { return; }
+ if nd < 0 || nd >= a.count { return }
if can_round_up(a, nd) {
round_up(a, nd)
} else {
@@ -223,7 +223,7 @@ round :: proc(a: ^Decimal, nd: int) {
}
round_up :: proc(a: ^Decimal, nd: int) {
- if nd < 0 || nd >= a.count { return; }
+ if nd < 0 || nd >= a.count { return }
for i := nd-1; i >= 0; i -= 1 {
if c := a.digits[i]; c < '9' {
@@ -240,7 +240,7 @@ round_up :: proc(a: ^Decimal, nd: int) {
}
round_down :: proc(a: ^Decimal, nd: int) {
- if nd < 0 || nd >= a.count { return; }
+ if nd < 0 || nd >= a.count { return }
a.count = nd
trim(a)
}
diff --git a/core/strconv/strconv.odin b/core/strconv/strconv.odin
index 782f9d9a3..7881f094a 100644
--- a/core/strconv/strconv.odin
+++ b/core/strconv/strconv.odin
@@ -402,11 +402,11 @@ parse_f64 :: proc(str: string) -> (value: f64, ok: bool) {
}
exp = exp * 10 + d
}
- if exp > 308 { exp = 308; }
+ if exp > 308 { exp = 308 }
- for exp >= 50 { scale *= 1e50; exp -= 50; }
- for exp >= 8 { scale *= 1e8; exp -= 8; }
- for exp > 0 { scale *= 10; exp -= 1; }
+ for exp >= 50 { scale *= 1e50; exp -= 50 }
+ for exp >= 8 { scale *= 1e8; exp -= 8 }
+ for exp > 0 { scale *= 10; exp -= 1 }
}
}
s = s[i:]
diff --git a/core/strings/strings.odin b/core/strings/strings.odin
index 2919a6e47..6ace03b48 100644
--- a/core/strings/strings.odin
+++ b/core/strings/strings.odin
@@ -207,11 +207,11 @@ cut :: proc(s: string, rune_offset := int(0), rune_length := int(0), allocator :
s := s; rune_length := rune_length
l := utf8.rune_count_in_string(s)
- if rune_offset >= l { return ""; }
+ if rune_offset >= l { return "" }
if rune_offset == 0 && rune_length <= 0 {
return clone(s, allocator)
}
- if rune_length == 0 { rune_length = l; }
+ if rune_length == 0 { rune_length = l }
bytes_needed := min(rune_length * 4, len(s))
buf := make([]u8, bytes_needed, allocator)
@@ -226,7 +226,7 @@ cut :: proc(s: string, rune_offset := int(0), rune_length := int(0), allocator :
byte_offset += w
}
if rune_length > 0 {
- if i == rune_offset + rune_length - 1 { break; }
+ if i == rune_offset + rune_length - 1 { break }
}
s = s[w:]
}
diff --git a/core/sync/atomic.odin b/core/sync/atomic.odin
index 5996d981f..21dcea178 100644
--- a/core/sync/atomic.odin
+++ b/core/sync/atomic.odin
@@ -23,62 +23,62 @@ strongest_failure_ordering :: #force_inline proc(order: Ordering) -> Ordering {
}
fence :: #force_inline proc($order: Ordering) {
- when order == .Relaxed { #panic("there is no such thing as a relaxed fence"); }
- else when order == .Release { intrinsics.atomic_fence_rel(); }
- else when order == .Acquire { intrinsics.atomic_fence_acq(); }
- else when order == .Acquire_Release { intrinsics.atomic_fence_acqrel(); }
- else when order == .Sequentially_Consistent { intrinsics.atomic_fence(); }
- else { #panic("unknown order"); }
+ when order == .Relaxed { #panic("there is no such thing as a relaxed fence") }
+ else when order == .Release { intrinsics.atomic_fence_rel() }
+ else when order == .Acquire { intrinsics.atomic_fence_acq() }
+ else when order == .Acquire_Release { intrinsics.atomic_fence_acqrel() }
+ else when order == .Sequentially_Consistent { intrinsics.atomic_fence() }
+ else { #panic("unknown order") }
}
atomic_store :: #force_inline proc(dst: ^$T, val: T, $order: Ordering) {
- when order == .Relaxed { intrinsics.atomic_store_relaxed(dst, val); }
- else when order == .Release { intrinsics.atomic_store_rel(dst, val); }
- else when order == .Sequentially_Consistent { intrinsics.atomic_store(dst, val); }
- else when order == .Acquire { #panic("there is not such thing as an acquire store"); }
- else when order == .Acquire_Release { #panic("there is not such thing as an acquire/release store"); }
- else { #panic("unknown order"); }
+ when order == .Relaxed { intrinsics.atomic_store_relaxed(dst, val) }
+ else when order == .Release { intrinsics.atomic_store_rel(dst, val) }
+ else when order == .Sequentially_Consistent { intrinsics.atomic_store(dst, val) }
+ else when order == .Acquire { #panic("there is not such thing as an acquire store") }
+ else when order == .Acquire_Release { #panic("there is not such thing as an acquire/release store") }
+ else { #panic("unknown order") }
}
atomic_load :: #force_inline proc(dst: ^$T, $order: Ordering) -> T {
- when order == .Relaxed { return intrinsics.atomic_load_relaxed(dst); }
- else when order == .Acquire { return intrinsics.atomic_load_acq(dst); }
- else when order == .Sequentially_Consistent { return intrinsics.atomic_load(dst); }
- else when order == .Release { #panic("there is no such thing as a release load"); }
- else when order == .Acquire_Release { #panic("there is no such thing as an acquire/release load"); }
- else { #panic("unknown order"); }
+ when order == .Relaxed { return intrinsics.atomic_load_relaxed(dst) }
+ else when order == .Acquire { return intrinsics.atomic_load_acq(dst) }
+ else when order == .Sequentially_Consistent { return intrinsics.atomic_load(dst) }
+ else when order == .Release { #panic("there is no such thing as a release load") }
+ else when order == .Acquire_Release { #panic("there is no such thing as an acquire/release load") }
+ else { #panic("unknown order") }
}
atomic_swap :: #force_inline proc(dst: ^$T, val: T, $order: Ordering) -> T {
- when order == .Relaxed { return intrinsics.atomic_xchg_relaxed(dst, val); }
- else when order == .Release { return intrinsics.atomic_xchg_rel(dst, val); }
- else when order == .Acquire { return intrinsics.atomic_xchg_acq(dst, val); }
- else when order == .Acquire_Release { return intrinsics.atomic_xchg_acqrel(dst, val); }
- else when order == .Sequentially_Consistent { return intrinsics.atomic_xchg(dst, val); }
- else { #panic("unknown order"); }
+ when order == .Relaxed { return intrinsics.atomic_xchg_relaxed(dst, val) }
+ else when order == .Release { return intrinsics.atomic_xchg_rel(dst, val) }
+ else when order == .Acquire { return intrinsics.atomic_xchg_acq(dst, val) }
+ else when order == .Acquire_Release { return intrinsics.atomic_xchg_acqrel(dst, val) }
+ else when order == .Sequentially_Consistent { return intrinsics.atomic_xchg(dst, val) }
+ else { #panic("unknown order") }
}
atomic_compare_exchange :: #force_inline proc(dst: ^$T, old, new: T, $success, $failure: Ordering) -> (val: T, ok: bool) {
when failure == .Relaxed {
- when success == .Relaxed { return intrinsics.atomic_cxchg_relaxed(dst, old, new); }
- else when success == .Acquire { return intrinsics.atomic_cxchg_acq_failrelaxed(dst, old, new); }
- else when success == .Acquire_Release { return intrinsics.atomic_cxchg_acqrel_failrelaxed(dst, old, new); }
- else when success == .Sequentially_Consistent { return intrinsics.atomic_cxchg_failrelaxed(dst, old, new); }
- else when success == .Release { return intrinsics.atomic_cxchg_rel(dst, old, new); }
- else { #panic("an unknown ordering combination"); }
+ when success == .Relaxed { return intrinsics.atomic_cxchg_relaxed(dst, old, new) }
+ else when success == .Acquire { return intrinsics.atomic_cxchg_acq_failrelaxed(dst, old, new) }
+ else when success == .Acquire_Release { return intrinsics.atomic_cxchg_acqrel_failrelaxed(dst, old, new) }
+ else when success == .Sequentially_Consistent { return intrinsics.atomic_cxchg_failrelaxed(dst, old, new) }
+ else when success == .Release { return intrinsics.atomic_cxchg_rel(dst, old, new) }
+ else { #panic("an unknown ordering combination") }
} else when failure == .Acquire {
- when success == .Release { return intrinsics.atomic_cxchg_acqrel(dst, old, new); }
- else when success == .Acquire { return intrinsics.atomic_cxchg_acq(dst, old, new); }
- else { #panic("an unknown ordering combination"); }
+ when success == .Release { return intrinsics.atomic_cxchg_acqrel(dst, old, new) }
+ else when success == .Acquire { return intrinsics.atomic_cxchg_acq(dst, old, new) }
+ else { #panic("an unknown ordering combination") }
} else when failure == .Sequentially_Consistent {
- when success == .Sequentially_Consistent { return intrinsics.atomic_cxchg(dst, old, new); }
- else { #panic("an unknown ordering combination"); }
+ when success == .Sequentially_Consistent { return intrinsics.atomic_cxchg(dst, old, new) }
+ else { #panic("an unknown ordering combination") }
} else when failure == .Acquire_Release {
#panic("there is not such thing as an acquire/release failure ordering")
} else when failure == .Release {
- when success == .Acquire { return instrinsics.atomic_cxchg_failacq(dst, old, new); }
- else { #panic("an unknown ordering combination"); }
+ when success == .Acquire { return instrinsics.atomic_cxchg_failacq(dst, old, new) }
+ else { #panic("an unknown ordering combination") }
} else {
return T{}, false
}
@@ -87,24 +87,24 @@ atomic_compare_exchange :: #force_inline proc(dst: ^$T, old, new: T, $success, $
atomic_compare_exchange_weak :: #force_inline proc(dst: ^$T, old, new: T, $success, $failure: Ordering) -> (val: T, ok: bool) {
when failure == .Relaxed {
- when success == .Relaxed { return intrinsics.atomic_cxchgweak_relaxed(dst, old, new); }
- else when success == .Acquire { return intrinsics.atomic_cxchgweak_acq_failrelaxed(dst, old, new); }
- else when success == .Acquire_Release { return intrinsics.atomic_cxchgweak_acqrel_failrelaxed(dst, old, new); }
- else when success == .Sequentially_Consistent { return intrinsics.atomic_cxchgweak_failrelaxed(dst, old, new); }
- else when success == .Release { return intrinsics.atomic_cxchgweak_rel(dst, old, new); }
- else { #panic("an unknown ordering combination"); }
+ when success == .Relaxed { return intrinsics.atomic_cxchgweak_relaxed(dst, old, new) }
+ else when success == .Acquire { return intrinsics.atomic_cxchgweak_acq_failrelaxed(dst, old, new) }
+ else when success == .Acquire_Release { return intrinsics.atomic_cxchgweak_acqrel_failrelaxed(dst, old, new) }
+ else when success == .Sequentially_Consistent { return intrinsics.atomic_cxchgweak_failrelaxed(dst, old, new) }
+ else when success == .Release { return intrinsics.atomic_cxchgweak_rel(dst, old, new) }
+ else { #panic("an unknown ordering combination") }
} else when failure == .Acquire {
- when success == .Release { return intrinsics.atomic_cxchgweak_acqrel(dst, old, new); }
- else when success == .Acquire { return intrinsics.atomic_cxchgweak_acq(dst, old, new); }
- else { #panic("an unknown ordering combination"); }
+ when success == .Release { return intrinsics.atomic_cxchgweak_acqrel(dst, old, new) }
+ else when success == .Acquire { return intrinsics.atomic_cxchgweak_acq(dst, old, new) }
+ else { #panic("an unknown ordering combination") }
} else when failure == .Sequentially_Consistent {
- when success == .Sequentially_Consistent { return intrinsics.atomic_cxchgweak(dst, old, new); }
- else { #panic("an unknown ordering combination"); }
+ when success == .Sequentially_Consistent { return intrinsics.atomic_cxchgweak(dst, old, new) }
+ else { #panic("an unknown ordering combination") }
} else when failure == .Acquire_Release {
#panic("there is not such thing as an acquire/release failure ordering")
} else when failure == .Release {
- when success == .Acquire { return intrinsics.atomic_cxchgweak_failacq(dst, old, new); }
- else { #panic("an unknown ordering combination"); }
+ when success == .Acquire { return intrinsics.atomic_cxchgweak_failacq(dst, old, new) }
+ else { #panic("an unknown ordering combination") }
} else {
return T{}, false
}
@@ -113,56 +113,56 @@ atomic_compare_exchange_weak :: #force_inline proc(dst: ^$T, old, new: T, $succe
atomic_add :: #force_inline proc(dst: ^$T, val: T, $order: Ordering) -> T {
- when order == .Relaxed { return intrinsics.atomic_add_relaxed(dst, val); }
- else when order == .Release { return intrinsics.atomic_add_rel(dst, val); }
- else when order == .Acquire { return intrinsics.atomic_add_acq(dst, val); }
- else when order == .Acquire_Release { return intrinsics.atomic_add_acqrel(dst, val); }
- else when order == .Sequentially_Consistent { return intrinsics.atomic_add(dst, val); }
- else { #panic("unknown order"); }
+ when order == .Relaxed { return intrinsics.atomic_add_relaxed(dst, val) }
+ else when order == .Release { return intrinsics.atomic_add_rel(dst, val) }
+ else when order == .Acquire { return intrinsics.atomic_add_acq(dst, val) }
+ else when order == .Acquire_Release { return intrinsics.atomic_add_acqrel(dst, val) }
+ else when order == .Sequentially_Consistent { return intrinsics.atomic_add(dst, val) }
+ else { #panic("unknown order") }
}
atomic_sub :: #force_inline proc(dst: ^$T, val: T, $order: Ordering) -> T {
- when order == .Relaxed { return intrinsics.atomic_sub_relaxed(dst, val); }
- else when order == .Release { return intrinsics.atomic_sub_rel(dst, val); }
- else when order == .Acquire { return intrinsics.atomic_sub_acq(dst, val); }
- else when order == .Acquire_Release { return intrinsics.atomic_sub_acqrel(dst, val); }
- else when order == .Sequentially_Consistent { return intrinsics.atomic_sub(dst, val); }
- else { #panic("unknown order"); }
+ when order == .Relaxed { return intrinsics.atomic_sub_relaxed(dst, val) }
+ else when order == .Release { return intrinsics.atomic_sub_rel(dst, val) }
+ else when order == .Acquire { return intrinsics.atomic_sub_acq(dst, val) }
+ else when order == .Acquire_Release { return intrinsics.atomic_sub_acqrel(dst, val) }
+ else when order == .Sequentially_Consistent { return intrinsics.atomic_sub(dst, val) }
+ else { #panic("unknown order") }
}
atomic_and :: #force_inline proc(dst: ^$T, val: T, $order: Ordering) -> T {
- when order == .Relaxed { return intrinsics.atomic_and_relaxed(dst, val); }
- else when order == .Release { return intrinsics.atomic_and_rel(dst, val); }
- else when order == .Acquire { return intrinsics.atomic_and_acq(dst, val); }
- else when order == .Acquire_Release { return intrinsics.atomic_and_acqrel(dst, val); }
- else when order == .Sequentially_Consistent { return intrinsics.atomic_and(dst, val); }
- else { #panic("unknown order"); }
+ when order == .Relaxed { return intrinsics.atomic_and_relaxed(dst, val) }
+ else when order == .Release { return intrinsics.atomic_and_rel(dst, val) }
+ else when order == .Acquire { return intrinsics.atomic_and_acq(dst, val) }
+ else when order == .Acquire_Release { return intrinsics.atomic_and_acqrel(dst, val) }
+ else when order == .Sequentially_Consistent { return intrinsics.atomic_and(dst, val) }
+ else { #panic("unknown order") }
}
atomic_nand :: #force_inline proc(dst: ^$T, val: T, $order: Ordering) -> T {
- when order == .Relaxed { return intrinsics.atomic_nand_relaxed(dst, val); }
- else when order == .Release { return intrinsics.atomic_nand_rel(dst, val); }
- else when order == .Acquire { return intrinsics.atomic_nand_acq(dst, val); }
- else when order == .Acquire_Release { return intrinsics.atomic_nand_acqrel(dst, val); }
- else when order == .Sequentially_Consistent { return intrinsics.atomic_nand(dst, val); }
- else { #panic("unknown order"); }
+ when order == .Relaxed { return intrinsics.atomic_nand_relaxed(dst, val) }
+ else when order == .Release { return intrinsics.atomic_nand_rel(dst, val) }
+ else when order == .Acquire { return intrinsics.atomic_nand_acq(dst, val) }
+ else when order == .Acquire_Release { return intrinsics.atomic_nand_acqrel(dst, val) }
+ else when order == .Sequentially_Consistent { return intrinsics.atomic_nand(dst, val) }
+ else { #panic("unknown order") }
}
atomic_or :: #force_inline proc(dst: ^$T, val: T, $order: Ordering) -> T {
- when order == .Relaxed { return intrinsics.atomic_or_relaxed(dst, val); }
- else when order == .Release { return intrinsics.atomic_or_rel(dst, val); }
- else when order == .Acquire { return intrinsics.atomic_or_acq(dst, val); }
- else when order == .Acquire_Release { return intrinsics.atomic_or_acqrel(dst, val); }
- else when order == .Sequentially_Consistent { return intrinsics.atomic_or(dst, val); }
- else { #panic("unknown order"); }
+ when order == .Relaxed { return intrinsics.atomic_or_relaxed(dst, val) }
+ else when order == .Release { return intrinsics.atomic_or_rel(dst, val) }
+ else when order == .Acquire { return intrinsics.atomic_or_acq(dst, val) }
+ else when order == .Acquire_Release { return intrinsics.atomic_or_acqrel(dst, val) }
+ else when order == .Sequentially_Consistent { return intrinsics.atomic_or(dst, val) }
+ else { #panic("unknown order") }
}
atomic_xor :: #force_inline proc(dst: ^$T, val: T, $order: Ordering) -> T {
- when order == .Relaxed { return intrinsics.atomic_xor_relaxed(dst, val); }
- else when order == .Release { return intrinsics.atomic_xor_rel(dst, val); }
- else when order == .Acquire { return intrinsics.atomic_xor_acq(dst, val); }
- else when order == .Acquire_Release { return intrinsics.atomic_xor_acqrel(dst, val); }
- else when order == .Sequentially_Consistent { return intrinsics.atomic_xor(dst, val); }
- else { #panic("unknown order"); }
+ when order == .Relaxed { return intrinsics.atomic_xor_relaxed(dst, val) }
+ else when order == .Release { return intrinsics.atomic_xor_rel(dst, val) }
+ else when order == .Acquire { return intrinsics.atomic_xor_acq(dst, val) }
+ else when order == .Acquire_Release { return intrinsics.atomic_xor_acqrel(dst, val) }
+ else when order == .Sequentially_Consistent { return intrinsics.atomic_xor(dst, val) }
+ else { #panic("unknown order") }
}
diff --git a/core/sys/win32/general.odin b/core/sys/win32/general.odin
index 5131fa8d8..12e929b71 100644
--- a/core/sys/win32/general.odin
+++ b/core/sys/win32/general.odin
@@ -847,12 +847,12 @@ get_query_performance_frequency :: proc() -> i64 {
return r
}
-HIWORD_W :: proc(wParam: Wparam) -> u16 { return u16((u32(wParam) >> 16) & 0xffff); }
-HIWORD_L :: proc(lParam: Lparam) -> u16 { return u16((u32(lParam) >> 16) & 0xffff); }
-LOWORD_W :: proc(wParam: Wparam) -> u16 { return u16(wParam); }
-LOWORD_L :: proc(lParam: Lparam) -> u16 { return u16(lParam); }
+HIWORD_W :: proc(wParam: Wparam) -> u16 { return u16((u32(wParam) >> 16) & 0xffff) }
+HIWORD_L :: proc(lParam: Lparam) -> u16 { return u16((u32(lParam) >> 16) & 0xffff) }
+LOWORD_W :: proc(wParam: Wparam) -> u16 { return u16(wParam) }
+LOWORD_L :: proc(lParam: Lparam) -> u16 { return u16(lParam) }
-is_key_down :: #force_inline proc(key: Key_Code) -> bool { return get_async_key_state(i32(key)) < 0; }
+is_key_down :: #force_inline proc(key: Key_Code) -> bool { return get_async_key_state(i32(key)) < 0 }
diff --git a/core/text/scanner/scanner.odin b/core/text/scanner/scanner.odin
index bd51b7bf5..72cdac76b 100644
--- a/core/text/scanner/scanner.odin
+++ b/core/text/scanner/scanner.odin
@@ -266,9 +266,9 @@ scan_identifier :: proc(s: ^Scanner) -> rune {
return ch
}
-@(private) lower :: proc(ch: rune) -> rune { return ('a' - 'A') | ch; }
-@(private) is_decimal :: proc(ch: rune) -> bool { return '0' <= ch && ch <= '9'; }
-@(private) is_hex :: proc(ch: rune) -> bool { return '0' <= ch && ch <= '9' || 'a' <= lower(ch) && lower(ch) <= 'f'; }
+@(private) lower :: proc(ch: rune) -> rune { return ('a' - 'A') | ch }
+@(private) is_decimal :: proc(ch: rune) -> bool { return '0' <= ch && ch <= '9' }
+@(private) is_hex :: proc(ch: rune) -> bool { return '0' <= ch && ch <= '9' || 'a' <= lower(ch) && lower(ch) <= 'f' }
diff --git a/core/unicode/utf16/utf16.odin b/core/unicode/utf16/utf16.odin
index 27edf088d..380381f9a 100644
--- a/core/unicode/utf16/utf16.odin
+++ b/core/unicode/utf16/utf16.odin
@@ -35,19 +35,19 @@ encode :: proc(d: []u16, s: []rune) -> int {
loop: for r in s {
switch r {
case 0..<_surr1, _surr3 ..< _surr_self:
- if m+1 < n { break loop; }
+ if m+1 < n { break loop }
d[n] = u16(r)
n += 1
case _surr_self ..= MAX_RUNE:
- if m+2 < n { break loop; }
+ if m+2 < n { break loop }
r1, r2 := encode_surrogate_pair(r)
d[n] = u16(r1)
d[n+1] = u16(r2)
n += 2
case:
- if m+1 < n { break loop; }
+ if m+1 < n { break loop }
d[n] = u16(REPLACEMENT_CHAR)
n += 1
}
@@ -61,19 +61,19 @@ encode_string :: proc(d: []u16, s: string) -> int {
loop: for r in s {
switch r {
case 0..<_surr1, _surr3 ..< _surr_self:
- if m+1 < n { break loop; }
+ if m+1 < n { break loop }
d[n] = u16(r)
n += 1
case _surr_self ..= MAX_RUNE:
- if m+2 < n { break loop; }
+ if m+2 < n { break loop }
r1, r2 := encode_surrogate_pair(r)
d[n] = u16(r1)
d[n+1] = u16(r2)
n += 2
case:
- if m+1 < n { break loop; }
+ if m+1 < n { break loop }
d[n] = u16(REPLACEMENT_CHAR)
n += 1
}