omdl  v0.9.5
OpenSCAD Mechanical Design Library
binary.scad File Reference

Base-2 binary numbers tests and operations. More...

+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

function binary_bit_is (v, b, t=1)
 Test if a binary bit position of an integer value equals a test bit. More...
 
function binary_i2v (v, w=1, bv=1)
 Encode an integer value as a binary list of bits. More...
 
function binary_v2i (v)
 Decode a binary list of bits to an integer value. More...
 
function binary_i2s (v, w=1)
 Encode an integer value as a binary string of bits. More...
 
function binary_s2i (v)
 Decode a binary string of bits to an integer value. More...
 
function binary_iw2i (v, s, w)
 Decode the binary bits of a bit window to an integer value. More...
 
function binary_and (v1, v2, bv=1)
 Base-2 binary AND operation for integers. More...
 
function binary_or (v1, v2, bv=1)
 Base-2 binary OR operation for integers. More...
 
function binary_xor (v1, v2, bv=1)
 Base-2 binary XOR operation for integers. More...
 
function binary_not (v, w=1, bv=1)
 Base-2 binary NOT operation for an integer. More...
 
function binary_ishl (v, s=1, bm=1, bv=1)
 Base-2 binary left-shift operation for an integer. More...
 
function binary_ishr (v, s=1)
 Base-2 binary right-shift operation for an integer. More...
 

Detailed Description

Base-2 binary numbers tests and operations.

Author
Roy Allen Sutton
Date
2017-2023

This file is part of omdl, an OpenSCAD mechanical design library.

The omdl is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.

The omdl is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with the omdl; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA; or see http://www.gnu.org/licenses/.

Definition in file binary.scad.