Quick Links
Overview
This topic provides general information on the implementation of the
Type BIT. From the Common Lisp HyperSpec, "The type Bit is equivalent to the type (integer 0 1) and (
unsigned-byte 1)." What this means is that a bit can be one of two values: the integer 0 or the integer 1. The type bit is a subtype of FixNum.
References
How are Bits Created?
Bits are created by a Factory class contained in the Integer class (lisp.common.type.Integer). When the lisp user wants to create a Integer, the system will send that number to the Integer class. The Integer class first determines if the number falls within a certain range. If it does fall within that range then it creates a FixNum. If it doesn't fall in that range it creates a BigNum. The range for FixNums is implementation dependent. For CLforJava that range is -2147483648 to 2147483647. If it is determined that the number is going to be created as a FixNum, it will perform one more check. This check is to see if the value is zero or one. If the value is zero or one, a Bit is created, otherwise it justs creates a FixNum.
Implementation
The type Bit will be created as a interface in lisp.common.type. Since bit is a subtype of FixNum the interface will extend the FixNum interface. The type Bit will contain two Bits that represent the value of zero and the value of one.
| Bit |
Value |
| ZERO |
new BitImpl("0") |
| ONE |
new BitImpl("1) |
The Bit type will be implemented in lisp.system in a class called BitImpl.
Note: The String val at this point will either be a zero or a one.
| Constructor |
Notes |
| public BitImpl(String val) |
Calls the super class (FixNumImpl) to handle the creating |
Methods - Interface Bit (lisp.common.type.Bit)
Core Java Interfaces
Core Java Classes
Discussions
Current Status of BitSpec
Test Suites