|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcse378.util.Bits
public class Bits
Constructor Summary | |
---|---|
Bits()
|
Method Summary | |
---|---|
static int |
extract(int num,
int start,
int width)
extract the value of a bitfield, |
static int |
extractSafe(int num,
int start,
int width)
extract the value of a bitfield |
static byte |
log2(int num)
compute the base 2 log of an integer |
static int |
mask(int num,
int maskBits,
int start)
extract the value of a bitfield |
static java.lang.String |
toBinaryString(int i)
|
static java.lang.String |
toBinaryString(int i,
int width)
|
static java.lang.String |
toHexString(int i)
|
static java.lang.String |
toHexString(int i,
int width)
|
private static java.lang.String |
toUnsignedString(int i,
int shift)
Convert the integer to an unsigned number. |
static int |
truncate(int num,
int bitWidth)
|
static int |
truncateSafe(int num,
int bitWidth)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Bits()
Method Detail |
---|
public static byte log2(int num)
num
-
public static int extractSafe(int num, int start, int width)
num
- start
- first bit to includewidth
- number of bits to include
public static int extract(int num, int start, int width)
num
- start
- first bit to includewidth
- number of bits to include
public static int mask(int num, int maskBits, int start)
num
- start
- first bit to includeend
- last bit to include
public static int truncate(int num, int bitWidth)
public static int truncateSafe(int num, int bitWidth)
public static java.lang.String toHexString(int i)
public static java.lang.String toHexString(int i, int width)
public static java.lang.String toBinaryString(int i)
public static java.lang.String toBinaryString(int i, int width)
private static java.lang.String toUnsignedString(int i, int shift)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |