Handling 64-bit integers, miscellaneous coercions and unsigned math operations.
64-bit integers deserves special attention. On the JVM, there is no explicit unsigned 64-bit type and in JS, there are no 64-bit integers at all. This is why creating and handling them in a cross-platform manner, signed or unsigned, is done via this namespace.
On the JVM, unsigned 64-bit integers are actually regular 64-bit signed values but treated differently.
What matters is the bit pattern. For human-readability, see str-u.
In JS, they are BigInt, a type which does not even interoperate with regular numbers.
As a rule, all values in any operation must be 64-bit integers since THEY DO NOT MIX with <= 32-bit integers.
This namespace provides functions for logical and mathematical operations for which sign matters (such as u<=
or udiv) as well as bitwise operations which need an alternative implementation (such as bit-clear).
Handling 64-bit integers, miscellaneous coercions and unsigned math operations. 64-bit integers deserves special attention. On the JVM, there is no explicit unsigned 64-bit type and in JS, there are no 64-bit integers at all. This is why creating and handling them in a cross-platform manner, signed or unsigned, is done via this namespace. On the JVM, unsigned 64-bit integers are actually regular 64-bit signed values but treated differently. What matters is the bit pattern. For human-readability, see [[str-u]]. In JS, they are `BigInt`, a type which does not even interoperate with regular numbers. As a rule, all values in any operation must be 64-bit integers since THEY DO NOT MIX with <= 32-bit integers. This namespace provides functions for logical and mathematical operations for which sign matters (such as [[u<=]] or [[udiv]]) as well as bitwise operations which need an alternative implementation (such as [[bit-clear]]).
(bit-clear x n)64-bit equivalent of the related standard function.
64-bit equivalent of the related standard function.
(bit-flip x n)64-bit equivalent of the related standard function.
64-bit equivalent of the related standard function.
(bit-set x n)64-bit equivalent of the related standard function.
64-bit equivalent of the related standard function.
(bit-test x n)64-bit equivalent of the related standard function.
64-bit equivalent of the related standard function.
(i* n)Macro for declaring a signed 64-bit integer.
(def n
(i* -9223372036854775808))
Macro for declaring a signed 64-bit integer.
```clojure
(def n
(i* -9223372036854775808))
```(i16 b64)Converts a 64-bit integer to a signed 16-bit integer.
Converts a 64-bit integer to a signed 16-bit integer.
(i32 b64)Converts a 64-bit integer to a signed 32-bit integer.
Converts a 64-bit integer to a signed 32-bit integer.
(i8 b64)Converts a 64-bit integer to a signed 8-bit integer.
Converts a 64-bit integer to a signed 8-bit integer.
(str-i i64)(str-i radix i64)Converts the given signed 64-bit integer into a string.
A radix can be provided (eg. 16 for hexadecimal or 2 for binary).
Converts the given signed 64-bit integer into a string. A radix can be provided (eg. 16 for hexadecimal or 2 for binary).
(str-u u64)(str-u radix u64)Converts the given unsigned 64-bit integer into a string.
A radix can be provided (eg. 16 for hexadecimal or 2 for binary).
Converts the given unsigned 64-bit integer into a string. A radix can be provided (eg. 16 for hexadecimal or 2 for binary).
(u* n)Macro for declaring an unsigned 64-bit integer.
(def n
(u* 18446744073709551615))
Macro for declaring an unsigned 64-bit integer.
```clojure
(def n
(u* 18446744073709551615))
```(u16 b64)Converts a 64-bit integer to an unsigned 16-bit integer.
Converts a 64-bit integer to an unsigned 16-bit integer.
(u32 b64)Converts a 64-bit integer to an unsigned 32-bit integer.
Converts a 64-bit integer to an unsigned 32-bit integer.
(u8 b64)Converts a 64-bit integer to an unsigned 8-bit integer.
Converts a 64-bit integer to an unsigned 8-bit integer.
(u< u64-1 u64-2)Unsigned 64-bit equivalent of standard <.
Unsigned 64-bit equivalent of standard `<`.
(u<= u64-1 u64-2)Unsigned 64-bit equivalent of standard <=.
Unsigned 64-bit equivalent of standard `<=`.
(u> u64-1 u64-2)Unsigned 64-bit equivalent of standard >.
Unsigned 64-bit equivalent of standard `>`.
(u>= u64-1 u64-2)Unsigned 64-bit equivalent of standard >=.
Unsigned 64-bit equivalent of standard `>=`.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |