eighty-eighty-js
Version:
A nice little Intel 8080 emulator for Node.js and Browser!
28 lines (27 loc) • 953 B
TypeScript
import { u8 } from 'typed-numbers';
/**
* Handles bit operations.
*/
export declare class Bit {
/**
* Get bit in `num` at `position`.
* @param num - The number to read.
* @param position - The position of the bit to return.
* @return - The bit as boolean (`0` = `false`, `1` = `true`).
*/
static get(num: u8, position: number): boolean;
/**
* Sets the bit in `num` at `position` to `value`.
* @param num - The number to modify.
* @param position - The position of the bit to set.
* @param value - The new bit as boolean (`0` = `false`, `1` = `true`).
* @return - The resulting number.
*/
static set(num: u8, position: number, value: boolean): u8;
/**
* Returns the number of ones in the binary representation of a number.
* @param num - The number.
* @return - The number of ones.
*/
static countOnes(num: number): number;
}