diff --git a/gitlab-pages/docs/reference/bitwise.md b/gitlab-pages/docs/reference/bitwise.md index 9d4df471a..7796e94c6 100644 --- a/gitlab-pages/docs/reference/bitwise.md +++ b/gitlab-pages/docs/reference/bitwise.md @@ -9,17 +9,42 @@ import Syntax from '@theme/Syntax'; import SyntaxTitle from '@theme/SyntaxTitle'; -function and : nat -> nat -> nat +function and : 'a -> nat -> nat -val and : nat -> nat -> nat +val and : 'a -> nat -> nat -let and: (nat, nat) => nat +let and: ('a, nat) => nat +`'a` can either be an `int` or `nat`. + A bitwise `and` operation. + + +```pascaligo +const zero: nat = Bitwise.and(2n, 1n) +``` + + + + +```cameligo +let zero: nat = Bitwise.and 2n 1n +``` + + + + +```reasonligo +let zero: nat = Bitwise.and(2n, 1n); +``` + + + + function or : nat -> nat -> nat @@ -32,6 +57,28 @@ let or: (nat, nat) => nat A bitwise `or` operation. + + +```pascaligo +const three: nat = Bitwise.or(2n, 1n) +``` + + + + +```cameligo +let three: nat = Bitwise.or 2n 1n +``` + + + + +```reasonligo +let three: nat = Bitwise.or(2n, 1n); +``` + + + function xor : nat -> nat -> nat @@ -44,6 +91,28 @@ let xor: (nat, nat) => nat A bitwise `xor` operation. + + +```pascaligo +const three: nat = Bitwise.xor(2n, 1n) +``` + + + + +```cameligo +let three: nat = Bitwise.xor 2n 1n +``` + + + + +```reasonligo +let three: nat = Bitwise.xor(2n, 1n); +``` + + + function shift_left : nat -> nat -> nat @@ -56,6 +125,28 @@ let shift_left: (nat, nat) => nat A bitwise shift left operation. + + +```pascaligo +const four: nat = Bitwise.shift_left(2n, 1n) +``` + + + + +```cameligo +let four: nat = Bitwise.shift_left 2n 1n +``` + + + + +```reasonligo +let four: nat = Bitwise.shift_left(2n, 1n); +``` + + + function shift_right : nat -> nat -> nat @@ -67,3 +158,25 @@ let shift_right: (nat, nat) => nat A bitwise shift right operation. + + + +```pascaligo +const one: nat = Bitwise.shift_right(2n, 1n) +``` + + + + +```cameligo +let one: nat = Bitwise.shift_right 2n 1n +``` + + + + +```reasonligo +let one: nat = Bitwise.shift_right(2n, 1n); +``` + + \ No newline at end of file