mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-05 07:08:48 +00:00
Rename bitwise operations to bit_or etc
This commit is contained in:
@@ -22,43 +22,43 @@ package math_big
|
|||||||
/*
|
/*
|
||||||
2's complement `and`, returns `dest = a & b;`
|
2's complement `and`, returns `dest = a & b;`
|
||||||
*/
|
*/
|
||||||
int_and :: proc(dest, a, b: ^Int, allocator := context.allocator) -> (err: Error) {
|
int_bit_and :: proc(dest, a, b: ^Int, allocator := context.allocator) -> (err: Error) {
|
||||||
assert_if_nil(dest, a, b)
|
assert_if_nil(dest, a, b)
|
||||||
context.allocator = allocator
|
context.allocator = allocator
|
||||||
|
|
||||||
internal_clear_if_uninitialized(a, b) or_return
|
internal_clear_if_uninitialized(a, b) or_return
|
||||||
return #force_inline internal_int_and(dest, a, b)
|
return #force_inline internal_int_and(dest, a, b)
|
||||||
}
|
}
|
||||||
and :: proc { int_and, }
|
bit_and :: proc { int_bit_and, }
|
||||||
|
|
||||||
/*
|
/*
|
||||||
2's complement `or`, returns `dest = a | b;`
|
2's complement `or`, returns `dest = a | b;`
|
||||||
*/
|
*/
|
||||||
int_or :: proc(dest, a, b: ^Int, allocator := context.allocator) -> (err: Error) {
|
int_bit_or :: proc(dest, a, b: ^Int, allocator := context.allocator) -> (err: Error) {
|
||||||
assert_if_nil(dest, a, b)
|
assert_if_nil(dest, a, b)
|
||||||
context.allocator = allocator
|
context.allocator = allocator
|
||||||
|
|
||||||
internal_clear_if_uninitialized(a, b) or_return
|
internal_clear_if_uninitialized(a, b) or_return
|
||||||
return #force_inline internal_int_or(dest, a, b)
|
return #force_inline internal_int_or(dest, a, b)
|
||||||
}
|
}
|
||||||
or :: proc { int_or, }
|
bit_or :: proc { int_bit_or, }
|
||||||
|
|
||||||
/*
|
/*
|
||||||
2's complement `xor`, returns `dest = a ^ b;`
|
2's complement `xor`, returns `dest = a ^ b;`
|
||||||
*/
|
*/
|
||||||
int_xor :: proc(dest, a, b: ^Int, allocator := context.allocator) -> (err: Error) {
|
int_bit_xor :: proc(dest, a, b: ^Int, allocator := context.allocator) -> (err: Error) {
|
||||||
assert_if_nil(dest, a, b)
|
assert_if_nil(dest, a, b)
|
||||||
context.allocator = allocator
|
context.allocator = allocator
|
||||||
|
|
||||||
internal_clear_if_uninitialized(a, b) or_return
|
internal_clear_if_uninitialized(a, b) or_return
|
||||||
return #force_inline internal_int_xor(dest, a, b)
|
return #force_inline internal_int_xor(dest, a, b)
|
||||||
}
|
}
|
||||||
xor :: proc { int_xor, }
|
bit_xor :: proc { int_bit_xor, }
|
||||||
|
|
||||||
/*
|
/*
|
||||||
dest = ~src
|
dest = ~src
|
||||||
*/
|
*/
|
||||||
int_complement :: proc(dest, src: ^Int, allocator := context.allocator) -> (err: Error) {
|
int_bit_complement :: proc(dest, src: ^Int, allocator := context.allocator) -> (err: Error) {
|
||||||
/*
|
/*
|
||||||
Check that `src` and `dest` are usable.
|
Check that `src` and `dest` are usable.
|
||||||
*/
|
*/
|
||||||
@@ -68,7 +68,7 @@ int_complement :: proc(dest, src: ^Int, allocator := context.allocator) -> (err:
|
|||||||
internal_clear_if_uninitialized(dest, src) or_return
|
internal_clear_if_uninitialized(dest, src) or_return
|
||||||
return #force_inline internal_int_complement(dest, src)
|
return #force_inline internal_int_complement(dest, src)
|
||||||
}
|
}
|
||||||
complement :: proc { int_complement, }
|
bit_complement :: proc { int_bit_complement, }
|
||||||
|
|
||||||
/*
|
/*
|
||||||
quotient, remainder := numerator >> bits;
|
quotient, remainder := numerator >> bits;
|
||||||
|
|||||||
Reference in New Issue
Block a user