diff options
| author | gingerBill <bill@gingerbill.org> | 2024-06-29 19:11:36 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2024-06-29 19:11:36 +0100 |
| commit | 5413a8b744deba571287cc830e017369c46e847b (patch) | |
| tree | ac4cfbdf14ac5368cbc0c9a1d1b581111927f595 /core | |
| parent | 3f9a58808cd95946043ab38523588aec5d8c68dc (diff) | |
Even more style fixes
Diffstat (limited to 'core')
| -rw-r--r-- | core/container/bit_array/bit_array.odin | 4 | ||||
| -rw-r--r-- | core/encoding/cbor/coding.odin | 2 | ||||
| -rw-r--r-- | core/encoding/cbor/marshal.odin | 2 | ||||
| -rw-r--r-- | core/fmt/fmt.odin | 15 | ||||
| -rw-r--r-- | core/image/bmp/bmp.odin | 2 | ||||
| -rw-r--r-- | core/image/png/png.odin | 4 | ||||
| -rw-r--r-- | core/image/qoi/qoi.odin | 2 | ||||
| -rw-r--r-- | core/image/tga/tga.odin | 2 | ||||
| -rw-r--r-- | core/math/noise/internal.odin | 12 | ||||
| -rw-r--r-- | core/mem/virtual/virtual_linux.odin | 6 | ||||
| -rw-r--r-- | core/net/interface_darwin.odin | 4 | ||||
| -rw-r--r-- | core/net/socket_darwin.odin | 2 | ||||
| -rw-r--r-- | core/net/socket_linux.odin | 4 | ||||
| -rw-r--r-- | core/slice/slice.odin | 2 | ||||
| -rw-r--r-- | core/sys/linux/bits.odin | 20 |
15 files changed, 39 insertions, 44 deletions
diff --git a/core/container/bit_array/bit_array.odin b/core/container/bit_array/bit_array.odin index a8720715c..398cede50 100644 --- a/core/container/bit_array/bit_array.odin +++ b/core/container/bit_array/bit_array.odin @@ -211,7 +211,7 @@ set :: proc(ba: ^Bit_Array, #any_int index: uint, set_to: bool = true, allocator ba.max_index = max(idx, ba.max_index) if set_to{ ba.bits[leg_index] |= 1 << uint(bit_index) } - else { ba.bits[leg_index] &= ~(1 << uint(bit_index)) } + else { ba.bits[leg_index] &~= 1 << uint(bit_index) } return true } @@ -253,7 +253,7 @@ Inputs: - index: Which bit in the array */ unsafe_unset :: proc(b: ^Bit_Array, bit: int) #no_bounds_check { - b.bits[bit >> INDEX_SHIFT] &= ~(1 << uint(bit & INDEX_MASK)) + b.bits[bit >> INDEX_SHIFT] &~= 1 << uint(bit & INDEX_MASK) } /* A helper function to create a Bit Array with optional bias, in case your smallest index is non-zero (including negative). diff --git a/core/encoding/cbor/coding.odin b/core/encoding/cbor/coding.odin index 07f0637a6..f82dc4b81 100644 --- a/core/encoding/cbor/coding.odin +++ b/core/encoding/cbor/coding.odin @@ -233,7 +233,7 @@ encode_into_encoder :: proc(e: Encoder, v: Value, loc := #caller_location) -> En if .Self_Described_CBOR in e.flags { _encode_u64(e, TAG_SELF_DESCRIBED_CBOR, .Tag) or_return - e.flags &~= { .Self_Described_CBOR } + e.flags -= { .Self_Described_CBOR } } switch v_spec in v { diff --git a/core/encoding/cbor/marshal.odin b/core/encoding/cbor/marshal.odin index 775eafd9c..d64d22d9c 100644 --- a/core/encoding/cbor/marshal.odin +++ b/core/encoding/cbor/marshal.odin @@ -85,7 +85,7 @@ marshal_into_encoder :: proc(e: Encoder, v: any, loc := #caller_location) -> (e if .Self_Described_CBOR in e.flags { err_conv(_encode_u64(e, TAG_SELF_DESCRIBED_CBOR, .Tag)) or_return - e.flags &~= { .Self_Described_CBOR } + e.flags -= { .Self_Described_CBOR } } if v == nil { diff --git a/core/fmt/fmt.odin b/core/fmt/fmt.odin index 424e4e6e8..16d35d94a 100644 --- a/core/fmt/fmt.odin +++ b/core/fmt/fmt.odin @@ -1072,8 +1072,8 @@ _fmt_int :: proc(fi: ^Info, u: u64, base: int, is_signed: bool, bit_size: int, d } flags: strconv.Int_Flags - if fi.hash && !fi.zero && start == 0 { flags |= {.Prefix} } - if fi.plus { flags |= {.Plus} } + if fi.hash && !fi.zero && start == 0 { flags += {.Prefix} } + if fi.plus { flags += {.Plus} } s := strconv.append_bits(buf[start:], u, base, is_signed, bit_size, digits, flags) prev_zero := fi.zero defer fi.zero = prev_zero @@ -1157,8 +1157,8 @@ _fmt_int_128 :: proc(fi: ^Info, u: u128, base: int, is_signed: bool, bit_size: i } flags: strconv.Int_Flags - if fi.hash && !fi.zero && start == 0 { flags |= {.Prefix} } - if fi.plus { flags |= {.Plus} } + if fi.hash && !fi.zero && start == 0 { flags += {.Prefix} } + if fi.plus { flags += {.Plus} } s := strconv.append_bits_128(buf[start:], u, base, is_signed, bit_size, digits, flags) if fi.hash && fi.zero && fi.indent == 0 { @@ -1460,13 +1460,10 @@ fmt_string :: proc(fi: ^Info, s: string, verb: rune) { if !fi.minus { io.write_string(fi.writer, s, &fi.n) } - } - else { + } else { io.write_string(fi.writer, s, &fi.n) } - } - else - { + } else { io.write_string(fi.writer, s, &fi.n) } diff --git a/core/image/bmp/bmp.odin b/core/image/bmp/bmp.odin index 64fc1d5a8..dac1b7ab5 100644 --- a/core/image/bmp/bmp.odin +++ b/core/image/bmp/bmp.odin @@ -131,7 +131,7 @@ load_from_context :: proc(ctx: ^$C, options := Options{}, allocator := context.a runtime.DEFAULT_TEMP_ALLOCATOR_TEMP_GUARD() if .info in options { - options |= {.return_metadata, .do_not_decompress_image} + options += {.return_metadata, .do_not_decompress_image} options -= {.info} } diff --git a/core/image/png/png.odin b/core/image/png/png.odin index aa42c5f56..177269722 100644 --- a/core/image/png/png.odin +++ b/core/image/png/png.odin @@ -341,7 +341,7 @@ load_from_context :: proc(ctx: ^$C, options := Options{}, allocator := context.a options := options if .info in options { - options |= {.return_metadata, .do_not_decompress_image} + options += {.return_metadata, .do_not_decompress_image} options -= {.info} } @@ -354,7 +354,7 @@ load_from_context :: proc(ctx: ^$C, options := Options{}, allocator := context.a } if .do_not_expand_channels in options { - options |= {.do_not_expand_grayscale, .do_not_expand_indexed} + options += {.do_not_expand_grayscale, .do_not_expand_indexed} } if img == nil { diff --git a/core/image/qoi/qoi.odin b/core/image/qoi/qoi.odin index 15ed449da..a121999ea 100644 --- a/core/image/qoi/qoi.odin +++ b/core/image/qoi/qoi.odin @@ -176,7 +176,7 @@ load_from_context :: proc(ctx: ^$C, options := Options{}, allocator := context.a options := options if .info in options { - options |= {.return_metadata, .do_not_decompress_image} + options += {.return_metadata, .do_not_decompress_image} options -= {.info} } diff --git a/core/image/tga/tga.odin b/core/image/tga/tga.odin index 03ef1a386..46e37a0cf 100644 --- a/core/image/tga/tga.odin +++ b/core/image/tga/tga.odin @@ -100,7 +100,7 @@ load_from_context :: proc(ctx: ^$C, options := Options{}, allocator := context.a } if .info in options { - options |= {.return_metadata, .do_not_decompress_image} + options += {.return_metadata, .do_not_decompress_image} options -= {.info} } diff --git a/core/math/noise/internal.odin b/core/math/noise/internal.odin index 5837f9235..b83c4f1b1 100644 --- a/core/math/noise/internal.odin +++ b/core/math/noise/internal.odin @@ -637,22 +637,20 @@ _internal_noise_4d_unskewed_base :: proc(seed: i64, coord: Vec4) -> (value: f32) // Next point is the closest vertex on the 4-simplex whose base vertex is the aforementioned vertex. score := 1.0 + ssi * (-1.0 / UNSKEW_4D) // Seems slightly faster than 1.0-xsi-ysi-zsi-wsi - if si.x >= si.x && si.x >= si.z && si.x >= si.w && si.x >= score { + switch { + case si.x >= si.x && si.x >= si.z && si.x >= si.w && si.x >= score: svp.x += PRIME_X si.x -= 1 ssi -= UNSKEW_4D - } - else if si.y > si.x && si.y >= si.z && si.y >= si.w && si.y >= score { + case si.y > si.x && si.y >= si.z && si.y >= si.w && si.y >= score: svp.y += PRIME_Y si.y -= 1 ssi -= UNSKEW_4D - } - else if si.z > si.x && si.z > si.y && si.z >= si.w && si.z >= score { + case si.z > si.x && si.z > si.y && si.z >= si.w && si.z >= score: svp.z += PRIME_Z si.z -= 1 ssi -= UNSKEW_4D - } - else if si.w > si.x && si.w > si.y && si.w > si.z && si.w >= score { + case si.w > si.x && si.w > si.y && si.w > si.z && si.w >= score: svp.w += PRIME_W si.w -= 1 ssi -= UNSKEW_4D diff --git a/core/mem/virtual/virtual_linux.odin b/core/mem/virtual/virtual_linux.odin index 816a8bb84..0b4532baa 100644 --- a/core/mem/virtual/virtual_linux.odin +++ b/core/mem/virtual/virtual_linux.odin @@ -36,9 +36,9 @@ _release :: proc "contextless" (data: rawptr, size: uint) { _protect :: proc "contextless" (data: rawptr, size: uint, flags: Protect_Flags) -> bool { pflags: linux.Mem_Protection pflags = {} - if .Read in flags { pflags |= {.READ} } - if .Write in flags { pflags |= {.WRITE} } - if .Execute in flags { pflags |= {.EXEC} } + if .Read in flags { pflags += {.READ} } + if .Write in flags { pflags += {.WRITE} } + if .Execute in flags { pflags += {.EXEC} } errno := linux.mprotect(data, size, pflags) return errno == .NONE } diff --git a/core/net/interface_darwin.odin b/core/net/interface_darwin.odin index 59b0e01c5..68353264c 100644 --- a/core/net/interface_darwin.odin +++ b/core/net/interface_darwin.odin @@ -94,7 +94,7 @@ _enumerate_interfaces :: proc(allocator := context.allocator) -> (interfaces: [] state := Link_State{} if .UP in ifaddr.flags { - state |= {.Up} + state += {.Up} } /*if .DORMANT in ifaddr.flags { @@ -102,7 +102,7 @@ _enumerate_interfaces :: proc(allocator := context.allocator) -> (interfaces: [] }*/ if .LOOPBACK in ifaddr.flags { - state |= {.Loopback} + state += {.Loopback} } iface.link.state = state } diff --git a/core/net/socket_darwin.odin b/core/net/socket_darwin.odin index ba86f1005..3f0e576c1 100644 --- a/core/net/socket_darwin.odin +++ b/core/net/socket_darwin.odin @@ -320,7 +320,7 @@ _set_blocking :: proc(socket: Any_Socket, should_block: bool) -> (err: Network_E } if should_block { - flags &= ~int(os.O_NONBLOCK) + flags &~= int(os.O_NONBLOCK) } else { flags |= int(os.O_NONBLOCK) } diff --git a/core/net/socket_linux.odin b/core/net/socket_linux.odin index dc960a5fb..a5d553234 100644 --- a/core/net/socket_linux.odin +++ b/core/net/socket_linux.odin @@ -377,9 +377,9 @@ _set_blocking :: proc(sock: Any_Socket, should_block: bool) -> (err: Network_Err return Set_Blocking_Error(errno) } if should_block { - flags &= ~{.NONBLOCK} + flags -= {.NONBLOCK} } else { - flags |= {.NONBLOCK} + flags += {.NONBLOCK} } errno = linux.fcntl(os_sock, linux.F_SETFL, flags) if errno != .NONE { diff --git a/core/slice/slice.odin b/core/slice/slice.odin index 56cb25b4c..043e51aa5 100644 --- a/core/slice/slice.odin +++ b/core/slice/slice.odin @@ -711,7 +711,7 @@ enumerated_array :: proc(ptr: ^$T) -> []intrinsics.type_elem_type(T) @(require_results) enum_slice_to_bitset :: proc(enums: []$E, $T: typeid/bit_set[E]) -> (bits: T) where intrinsics.type_is_enum(E), intrinsics.type_bit_set_elem_type(T) == E { for v in enums { - bits |= {v} + bits += {v} } return } diff --git a/core/sys/linux/bits.odin b/core/sys/linux/bits.odin index bd686ed63..1e9e5bbbd 100644 --- a/core/sys/linux/bits.odin +++ b/core/sys/linux/bits.odin @@ -1464,16 +1464,16 @@ Futex_Flags_Bits :: enum { Kind of operation on futex, see FUTEX_WAKE_OP */ Futex_Arg_Op :: enum { - SET = 0, /* uaddr2 = oparg; */ - ADD = 1, /* uaddr2 += oparg; */ - OR = 2, /* uaddr2 |= oparg; */ - ANDN = 3, /* uaddr2 &= ~oparg; */ - XOR = 4, /* uaddr2 ^= oparg; */ - PO2_SET = 0, /* uaddr2 = 1<<oparg; */ - PO2_ADD = 1, /* uaddr2 += 1<<oparg; */ - PO2_OR = 2, /* uaddr2 |= 1<<oparg; */ - PO2_ANDN = 3, /* uaddr2 &= ~(1<<oparg); */ - PO2_XOR = 4, /* uaddr2 ^= 1<<oparg; */ + SET = 0, /* uaddr2 = oparg */ + ADD = 1, /* uaddr2 += oparg */ + OR = 2, /* uaddr2 |= oparg */ + ANDN = 3, /* uaddr2 &= ~oparg */ + XOR = 4, /* uaddr2 ^= oparg */ + PO2_SET = 0, /* uaddr2 = 1<<oparg */ + PO2_ADD = 1, /* uaddr2 += 1<<oparg */ + PO2_OR = 2, /* uaddr2 |= 1<<oparg */ + PO2_ANDN = 3, /* uaddr2 &~= 1<<oparg */ + PO2_XOR = 4, /* uaddr2 ^= 1<<oparg */ } /* |