Utils
Cubiomes.Utils — ModuleSome utility functions and types that are used in various places in the codebase. It should not be used directly by the user and could be nice if this module does not exist at all.
Index
Cubiomes.Utils.bytes2uint64Cubiomes.Utils.findfirst_defaultCubiomes.Utils.length_of_trimmedCubiomes.Utils.u64_seedCubiomes.Utils.@only_float32
API
Cubiomes.Utils.length_of_trimmed — Methodlength_of_trimmed(predicate, x) where NReturns the length of the collection x after removing the elements from the beginning and the end that satisfy the predicate.
⚠ The collection must have the property so that x[i] for i in firstindex(x):lastindex(x) is valid.
Cubiomes.Utils.u64_seed — Functionu64_seed(x)Converts x to UInt64 for use as a seed, exactly as the Minecraft Java Edition does. It can be any integer or a string.
Example
julia> u64_seed(1234)
0x00000000000004d2
julia> u64_seed("hello world")
0x000000006aefe2c4Cubiomes.Utils.@only_float32 — Macro@only_float32 exprTransforms all real literals in the expr to Float32.
Example
@only_float32 function f()
x = 1 + 2im # expand to `1.0f0 + 2.0f0im`
x += 1 # expand to `x += 1.0f0`
return x
endPrivate API
Click to see
Cubiomes.Utils.bytes2uint64 — Methodbytes2uint64(itr)Converts an iterator of bytes to an iterator of UInt64.
Example
julia> bytes2uint64([0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10]) |> collect
2-element Vector{UInt64}:
0x0102030405060708
0x090a0b0c0d0e0f10Cubiomes.Utils.findfirst_default — Methodfindfirst_default(predicate::Function, A, default)Return the first index i of A where predicate(A[i]) is true. If no i satisfy this, default is returned instead.