The bit-ops Reference Manual

This is the bit-ops Reference Manual, version 0.1, generated automatically by Declt version 4.0 beta 2 "William Riker" on Mon Feb 26 14:43:33 2024 GMT+0.

Table of Contents


1 Introduction


2 Systems

The main system appears first, followed by any subsystem dependency.


2.1 bit-ops

Optimized bit-vector operations

Author

Masataro Asai

Contact

Home Page

https://github.com/guicho271828/bit-ops

Source Control

(GIT https://github.com/guicho271828/bit-ops.git)

Bug Tracker

https://github.com/guicho271828/bit-ops/issues

License

LLGPL

Version

0.1

Dependencies
  • iterate (system).
  • alexandria (system).
  • trivia (system).
  • immutable-struct (system).
  • lisp-namespace (system).
Source

bit-ops.asd.

Child Component

src (module).


3 Modules

Modules are listed depth-first from the system components tree.


3.1 bit-ops/src

Source

bit-ops.asd.

Parent Component

bit-ops (system).

Child Components

4 Files

Files are sorted by type and then listed depth-first from the systems components trees.


4.1 Lisp


4.1.1 bit-ops/bit-ops.asd

Source

bit-ops.asd.

Parent Component

bit-ops (system).

ASDF Systems

bit-ops.

Packages

bit-ops-asd.


4.1.2 bit-ops/src/package.lisp

Source

bit-ops.asd.

Parent Component

src (module).

Packages

bit-ops.

Public Interface
Internals

4.1.3 bit-ops/src/macros.lisp

Source

bit-ops.asd.

Parent Component

src (module).


4.1.4 bit-ops/src/functions.lisp

Source

bit-ops.asd.

Parent Component

src (module).

Public Interface

5 Packages

Packages are listed by definition order.


5.1 bit-ops-asd

Source

bit-ops.asd.

Use List
  • asdf/interface.
  • common-lisp.

5.2 bit-ops

Source

package.lisp.

Use List
  • alexandria.
  • common-lisp.
  • iterate.
  • lisp-namespace.
  • trivia.level2.
Public Interface
Internals

6 Definitions

Definitions are sorted by export status, category, package, and then by lexicographic order.


6.1 Public Interface


6.1.1 Macros

Macro: as-bitwise-operations ((&key result) &body body)

Compute bitwise operations using bit vector arithmetic.
BODY accepts a single form. Within BODY, one can use variables holding bit-vectors as arguments to bitwise operations, as well as constants 0 and 1, which maps to the bit vector filled with
0 or 1, respectively.
All bit-vectors that are involved in bitwise operations should be of the same length.

Primitive operators corresponds to ANSI CL functions: For example, (not subform) is compiled into (bit-not subform <temporary storage>) . Following primitive operators are available:

not and andc1 andc2 eqv ior nand nor orc1 orc2 xor

Additionally, (SUBSEQ FORM OFFSET) operator evaluates FORM and
extracts its window starting from OFFSET and of the length equal to the other variables.
FORM is a regular lisp expression, not a bitwise operation, and the result may be different from the other bit-vectors.

The final computation result is stored in a newly allocated vector, or in RESULT if specified, in spirit similar to the optional argument of Common Lisp bit-vector functions.
The entire form returns the bit-vector which contains the result.

The compiler does various optimizations:

* Nested expressions store the results into dynamic-extent temporary vectors.
* Common subexpressions are eliminated.
* The number of temporary vectors are minimized/shared in spirit similar to register allocation. * Macros for bitwise operations can be defined with DEFINE-BITWISE-OPERATION.

Package

bit-ops.

Source

package.lisp.

Macro: define-bitwise-operation (name lambda-list &body body)

Defines a bitwise operation that is available within AS-BITWISE-OPERATIONS macro.

Primitive operators corresponds to ANSI CL functions: For example, (not subform) is compiled into (bit-not subform <temporary storage>) .

not and andc1 andc2 eqv ior nand nor orc1 orc2 xor

Package

bit-ops.

Source

package.lisp.

Macro: dlet (bindings &body body)
Package

bit-ops.

Source

package.lisp.

Macro: dlet* (bindings &body body)
Package

bit-ops.

Source

package.lisp.


6.1.2 Ordinary functions

Function: bit-if-then-else (condition then else &optional res)

if A_i=1 then B_i else C_i

Package

bit-ops.

Source

functions.lisp.

Function: bit-implies (bv1 bv2 &optional bv3)

a => b :- not a or b

Package

bit-ops.

Source

functions.lisp.

Function: make-bit-vector (length)
Package

bit-ops.

Source

package.lisp.


6.2 Internals


6.2.1 Special variables

Special Variable: *bitwise-operation-doc-table*
Package

bit-ops.

Source

package.lisp.

Special Variable: *bitwise-operation-table*
Package

bit-ops.

Source

package.lisp.

Special Variable: *common-subexpression-elimination*
Package

bit-ops.

Source

package.lisp.

Special Variable: *first-variable*
Package

bit-ops.

Source

package.lisp.

Special Variable: *length-variable*
Package

bit-ops.

Source

package.lisp.

Special Variable: *ops*
Package

bit-ops.

Source

package.lisp.

Special Variable: *register-allocation-optimization*
Package

bit-ops.

Source

package.lisp.

Special Variable: *result-variable*
Package

bit-ops.

Source

package.lisp.

Special Variable: *verbose*
Package

bit-ops.

Source

package.lisp.


6.2.2 Ordinary functions

Function: bit-replace (source offset destination)

Wrapper for REPLACE which follows the syntax of bit-* (The last arg is the destination).

Package

bit-ops.

Source

package.lisp.

Function: bitwise-operation-boundp (symbol)

Automatically defined boolean function.

Package

bit-ops.

Source

package.lisp.

Function: build-forms (result)
Package

bit-ops.

Source

package.lisp.

Function: common-subexpression (op1 op2)
Package

bit-ops.

Source

package.lisp.

Function: compile-bitwise-operations (form result)
Package

bit-ops.

Source

package.lisp.

Function: copy-op (instance)
Package

bit-ops.

Source

package.lisp.

Function: make-one (length)
Package

bit-ops.

Source

package.lisp.

Function: make-op (&key name inputs output)
Package

bit-ops.

Source

package.lisp.

Function: make-zero (length)
Package

bit-ops.

Source

package.lisp.

Function: op (name inputs output)
Package

bit-ops.

Source

package.lisp.

Reader: op-inputs (instance)
Writer: (setf op-inputs) (instance)
Package

bit-ops.

Source

package.lisp.

Target Slot

inputs.

Reader: op-name (instance)
Writer: (setf op-name) (instance)
Package

bit-ops.

Source

package.lisp.

Target Slot

name.

Reader: op-output (instance)
Writer: (setf op-output) (instance)
Package

bit-ops.

Source

package.lisp.

Target Slot

output.

Function: op-p (object)
Package

bit-ops.

Source

package.lisp.

Function: parse-form (form)
Package

bit-ops.

Source

package.lisp.

Function: reduce-allocation ()
Package

bit-ops.

Source

package.lisp.

Function: symbol-bitwise-operation (symbol &optional default)

Automatically defined getter function. When DEFAULT is supplied, the value is set automatically.

Package

bit-ops.

Source

package.lisp.

Function: (setf symbol-bitwise-operation) (symbol)

Automatically defined setter function.

Package

bit-ops.

Source

package.lisp.


6.2.3 Conditions

Condition: unbound-bitwise-operation
Package

bit-ops.

Source

package.lisp.

Direct superclasses

unbound-variable.


6.2.4 Structures

Structure: op
Package

bit-ops.

Source

package.lisp.

Direct superclasses

structure-object.

Direct slots
Slot: name
Readers

op-name.

Writers

(setf op-name).

Slot: inputs
Readers

op-inputs.

Writers

(setf op-inputs).

Slot: output
Readers

op-output.

Writers

(setf op-output).


6.2.5 Types

Type: bitwise-operation-type ()
Package

bit-ops.

Source

package.lisp.


Appendix A Indexes


A.1 Concepts


A.2 Functions

Jump to:   (  
A   B   C   D   F   M   O   P   R   S  
Index Entry  Section

(
(setf op-inputs): Private ordinary functions
(setf op-name): Private ordinary functions
(setf op-output): Private ordinary functions
(setf symbol-bitwise-operation): Private ordinary functions

A
as-bitwise-operations: Public macros

B
bit-if-then-else: Public ordinary functions
bit-implies: Public ordinary functions
bit-replace: Private ordinary functions
bitwise-operation-boundp: Private ordinary functions
build-forms: Private ordinary functions

C
common-subexpression: Private ordinary functions
compile-bitwise-operations: Private ordinary functions
copy-op: Private ordinary functions

D
define-bitwise-operation: Public macros
dlet: Public macros
dlet*: Public macros

F
Function, (setf op-inputs): Private ordinary functions
Function, (setf op-name): Private ordinary functions
Function, (setf op-output): Private ordinary functions
Function, (setf symbol-bitwise-operation): Private ordinary functions
Function, bit-if-then-else: Public ordinary functions
Function, bit-implies: Public ordinary functions
Function, bit-replace: Private ordinary functions
Function, bitwise-operation-boundp: Private ordinary functions
Function, build-forms: Private ordinary functions
Function, common-subexpression: Private ordinary functions
Function, compile-bitwise-operations: Private ordinary functions
Function, copy-op: Private ordinary functions
Function, make-bit-vector: Public ordinary functions
Function, make-one: Private ordinary functions
Function, make-op: Private ordinary functions
Function, make-zero: Private ordinary functions
Function, op: Private ordinary functions
Function, op-inputs: Private ordinary functions
Function, op-name: Private ordinary functions
Function, op-output: Private ordinary functions
Function, op-p: Private ordinary functions
Function, parse-form: Private ordinary functions
Function, reduce-allocation: Private ordinary functions
Function, symbol-bitwise-operation: Private ordinary functions

M
Macro, as-bitwise-operations: Public macros
Macro, define-bitwise-operation: Public macros
Macro, dlet: Public macros
Macro, dlet*: Public macros
make-bit-vector: Public ordinary functions
make-one: Private ordinary functions
make-op: Private ordinary functions
make-zero: Private ordinary functions

O
op: Private ordinary functions
op-inputs: Private ordinary functions
op-name: Private ordinary functions
op-output: Private ordinary functions
op-p: Private ordinary functions

P
parse-form: Private ordinary functions

R
reduce-allocation: Private ordinary functions

S
symbol-bitwise-operation: Private ordinary functions