diff options
author | Louis Pilfold <louis@lpil.uk> | 2023-09-04 13:36:36 +0100 |
---|---|---|
committer | Louis Pilfold <louis@lpil.uk> | 2023-09-04 13:38:50 +0100 |
commit | dcfa88a41c66db58d6cf5a166960836dcf5c1226 (patch) | |
tree | 7f8e2b7f3ec4b428d542225e3837e8f0cd51a213 /src | |
parent | 67fa467a7edb9c7b136905c61b1094c9c3160912 (diff) | |
download | gleam_stdlib-dcfa88a41c66db58d6cf5a166960836dcf5c1226.tar.gz gleam_stdlib-dcfa88a41c66db58d6cf5a166960836dcf5c1226.zip |
Remove extra wrapping
Diffstat (limited to 'src')
-rw-r--r-- | src/gleam/int.gleam | 66 |
1 files changed, 36 insertions, 30 deletions
diff --git a/src/gleam/int.gleam b/src/gleam/int.gleam index 2324bb0..e440365 100644 --- a/src/gleam/int.gleam +++ b/src/gleam/int.gleam @@ -802,55 +802,61 @@ pub fn subtract(a: Int, b: Int) -> Int { } /// Calculates the bitwise AND of its arguments. -pub fn bitwise_and(x: Int, y: Int) -> Int { - do_and(x, y) -} - +/// +/// The exact behaviour of this function depends on the target platform. +/// On Erlang it is equivalent to bitwise operations on ints, on JavaScript it +/// is equivalent to bitwise operations on big-ints. +/// @external(erlang, "erlang", "band") @external(javascript, "../gleam_stdlib.mjs", "bitwise_and") -fn do_and(a: Int, b: Int) -> Int +pub fn bitwise_and(x: Int, y: Int) -> Int /// Calculates the bitwise NOT of its argument. -pub fn bitwise_not(x: Int) -> Int { - do_not(x) -} - +/// +/// The exact behaviour of this function depends on the target platform. +/// On Erlang it is equivalent to bitwise operations on ints, on JavaScript it +/// is equivalent to bitwise operations on big-ints. +/// @external(erlang, "erlang", "bnot") @external(javascript, "../gleam_stdlib.mjs", "bitwise_not") -fn do_not(a: Int) -> Int +pub fn bitwise_not(x: Int) -> Int /// Calculates the bitwise OR of its arguments. -pub fn bitwise_or(x: Int, y: Int) -> Int { - do_or(x, y) -} - +/// +/// The exact behaviour of this function depends on the target platform. +/// On Erlang it is equivalent to bitwise operations on ints, on JavaScript it +/// is equivalent to bitwise operations on big-ints. +/// @external(erlang, "erlang", "bor") @external(javascript, "../gleam_stdlib.mjs", "bitwise_or") -fn do_or(a: Int, b: Int) -> Int +pub fn bitwise_or(x: Int, y: Int) -> Int /// Calculates the bitwise XOR of its arguments. -pub fn bitwise_exclusive_or(x: Int, y: Int) -> Int { - do_exclusive_or(x, y) -} - +/// +/// The exact behaviour of this function depends on the target platform. +/// On Erlang it is equivalent to bitwise operations on ints, on JavaScript it +/// is equivalent to bitwise operations on big-ints. +/// @external(erlang, "erlang", "bxor") @external(javascript, "../gleam_stdlib.mjs", "bitwise_exclusive_or") -fn do_exclusive_or(a: Int, b: Int) -> Int +pub fn bitwise_exclusive_or(x: Int, y: Int) -> Int /// Calculates the result of an arithmetic left bitshift. -pub fn bitwise_shift_left(x: Int, y: Int) -> Int { - do_shift_left(x, y) -} - +/// +/// The exact behaviour of this function depends on the target platform. +/// On Erlang it is equivalent to bitwise operations on ints, on JavaScript it +/// is equivalent to bitwise operations on big-ints. +/// @external(erlang, "erlang", "bsl") @external(javascript, "../gleam_stdlib.mjs", "bitwise_shift_left") -fn do_shift_left(a: Int, b: Int) -> Int +pub fn bitwise_shift_left(x: Int, y: Int) -> Int /// Calculates the result of an arithmetic right bitshift. -pub fn bitwise_shift_right(x: Int, y: Int) -> Int { - do_shift_right(x, y) -} - +/// +/// The exact behaviour of this function depends on the target platform. +/// On Erlang it is equivalent to bitwise operations on ints, on JavaScript it +/// is equivalent to bitwise operations on big-ints. +/// @external(erlang, "erlang", "bsr") @external(javascript, "../gleam_stdlib.mjs", "bitwise_shift_right") -fn do_shift_right(a: Int, b: Int) -> Int +pub fn bitwise_shift_right(x: Int, y: Int) -> Int |