https://github.com/holepunchto/libsimdle JavaScript bindings for Node.js.
npm install simdle-native
const { cnt } = require('simdle-native')
cnt(Buffer.alloc(16, 0xff))
// <Buffer 08 08 08 08 08 08 08 08 08 08 08 08 08 08 08 08>
The lane width of all APIs is determined by the input buffer. That is, if providing a Uint8Array
the lane width will be 8 bits, if providing a Uint16Array
the lane width will be 16 bits and so on.
Check if the buffer contains only ones.
Check if the buffer contains only zeros.
Compute the bitwise AND of a
and b
. If result
is not provided, a fresh buffer is allocated. The result
buffer is returned to the caller.
Clear the bits in b
from a
. If result
is not provided, a fresh buffer is allocated. The result
buffer is returned to the caller.
Count the number of leading ones in buffer
, storing the result in result
. If result
is not provided, a fresh buffer is allocated. The result
buffer is returned to the caller.
Count the number of leading zeroes in buffer
, storing the result in result
. If result
is not provided, a fresh buffer is allocated. The result
buffer is returned to the caller.
Compute the population count in buffer
, storing the result in result
. If result
is not provided, a fresh buffer is allocated. The result
buffer is returned to the caller.
Count the number of trailing ones in buffer
, storing the result in result
. If result
is not provided, a fresh buffer is allocated. The result
buffer is returned to the caller.
Count the number of trailing zeroes in buffer
, storing the result in result
. If result
is not provided, a fresh buffer is allocated. The result
buffer is returned to the caller.
Compute the bitwise NOT in buffer
, storing the result in result
. If result
is not provided, a fresh buffer is allocated. The result
buffer is returned to the caller.
Compute the bitwise OR of a
and b
. If result
is not provided, a fresh buffer is allocated. The result
buffer is returned to the caller.
Compute the sum of buffer
as a bigint
.
Compute the bitwise XOR of a
and b
. If result
is not provided, a fresh buffer is allocated. The result
buffer is returned to the caller.
Apache-2.0