Home / Docs / Standard library / Built-in methods
bit_or
Release v0.4.0Edition 0.2 and later
A built-in method, resolved by the type of its receiver (spec/14 §2). Edition 0.2 and later.
una
a.bit_or(mask: F) -> F
where a: F, one of I8, I16, I32, I64, U8, U16, U32, U64Total; on an unsigned type the result is at least a and at least mask (spec/18 §5).
Receiver
F, one of I8, I16, I32, I64, U8, U16, U32, U64: a fixed-width integera, of one of the eight typesI8,I16,I32,I64,U8,U16,U32andU64; the result has its type
Parameters
mask: the other operand, of the same type
Returns
F: the bits set in a or in mask, on the two's-complement bits of the width; on an unsigned type result >= a and result >= mask; it never fails.
See also
Example
src/shop.una
module shop
--- An item's flags with two more set.
pub main() -> Unit
uses @console: Console[print]
=
let flags: U8 = 8
let marked = flags.bit_or(mask: 3)
@console.print("{marked}")una run . prints:
Output
11Specification
Generated from una v0.4.0 (docs/std/builtins.json, which is not part of the specification): built-in methods have no declaration, so una writes these signature lines and tests each against its checker. The specification governs: spec/14 §2.