Library globals

Namespace globals . bits

View source

SPDX-License-Identifier: GPL-2.0-or-later

NOTE! This copyright does *not* cover user models that use these Nasal
services by normal function calls - this is merely considered normal
use of the code, and does *not* fall under the heading of "derived
work."

Copyright (C) 2008 by mfranz

Functions

clear

returns number <n> with bit <b> cleared

set

returns number <n> with bit <b> set

string

returns number <n> as bit string, zero-padded to <len> digits: bits.string(6) -> "110" bits.string(6, 8) -> "00000110"

switch

returns number <n> with bit <b> set to value <v>

test

checks whether bit <b> is set in number <n>

toggle

returns number <n> with bit <b> toggled

value

returns bit string <s> as number: bits.value("110") -> 6

Variables

bit