2019-05-27 21:12:10 +00:00
|
|
|
/*********************************************************
|
|
|
|
* intlib - Standard Library Routines for Integer Values *
|
|
|
|
*********************************************************/
|
|
|
|
|
2020-10-06 16:30:20 +00:00
|
|
|
/* Integer Absolute Value *
|
|
|
|
* Args: int w - Integer to test *
|
|
|
|
* Returns: int v -Absolute value of w */
|
2019-05-27 21:12:10 +00:00
|
|
|
char iabs();
|
|
|
|
|
2020-10-06 16:30:20 +00:00
|
|
|
/* Integer Add *
|
|
|
|
* Setup: setsrc(g) - Augend *
|
|
|
|
* Args: int d - Addend *
|
|
|
|
* Returns: char c - Carry *
|
|
|
|
* int r - Sum */
|
2019-05-27 21:12:10 +00:00
|
|
|
char iadd();
|
|
|
|
|
2020-10-06 16:30:20 +00:00
|
|
|
/* ASCII to Integer *
|
|
|
|
* Convert ASCII string to Unsigned Integer *
|
|
|
|
* Args: &s - String to Convert *
|
|
|
|
* Returns: char n - Number of digits parsed *
|
|
|
|
* int v - Numeric value of string */
|
2019-05-27 21:12:10 +00:00
|
|
|
char atoi();
|
|
|
|
|
2020-10-06 16:30:20 +00:00
|
|
|
/* Integer to ASCII *
|
|
|
|
* Convert Unsigned Integer to String *
|
|
|
|
* Setup: setdst(s) - Destination String *
|
|
|
|
* Args: int w - Unsigned Int to Convert *
|
|
|
|
* Returns: char n - Length of string */
|
2019-05-27 21:12:10 +00:00
|
|
|
void itoa();
|
|
|
|
|
2020-10-06 16:30:20 +00:00
|
|
|
/* Integer Divide *
|
|
|
|
* Divide Unsigned Integers *
|
|
|
|
* Aetup: setdst(n) - Numerator *
|
|
|
|
* Args: int d - Denominator *
|
|
|
|
* Returns: int q - Quotient */
|
2019-05-27 21:12:10 +00:00
|
|
|
char idiv();
|
|
|
|
|
2020-10-06 16:30:20 +00:00
|
|
|
/* Integer Maximum *
|
|
|
|
* Return Largest of Two Integers *
|
2019-05-27 21:12:10 +00:00
|
|
|
* Requires: setsrc(i) - First Integer *
|
2020-10-06 16:30:20 +00:00
|
|
|
* Args: int j - Second Integer *
|
|
|
|
* Returns: int m - Greater of the Two */
|
|
|
|
char imax();
|
2019-05-27 21:12:10 +00:00
|
|
|
|
2020-10-06 16:30:20 +00:00
|
|
|
/* Integer Minimum *
|
|
|
|
* Return smallest of Two Integers *
|
2019-05-27 21:12:10 +00:00
|
|
|
* Requires: setsrc(i) - First Integer *
|
2020-10-06 16:30:20 +00:00
|
|
|
* Args: int j - Second Integer *
|
|
|
|
* Returns: int m - Lesser of the Two */
|
|
|
|
char imin();
|
2019-05-27 21:12:10 +00:00
|
|
|
|
2020-10-06 16:30:20 +00:00
|
|
|
/* Integer Multiply *
|
|
|
|
* Multiply Unsigned Integers *
|
|
|
|
* Requires: setdst(m) - Muliplicand *
|
|
|
|
* Args: int r - Multiplier *
|
|
|
|
* Returns: long p - Product */
|
|
|
|
char imult();
|
2019-05-27 21:12:10 +00:00
|
|
|
|
2020-10-06 16:30:20 +00:00
|
|
|
/* Integer Left Shift *
|
|
|
|
* Args: char n - Number of Bits *
|
|
|
|
* int w - Value to Shift *
|
|
|
|
* Returns: char v - Overflow Bits *
|
|
|
|
int r - Shifted Integer */
|
2019-05-27 21:12:10 +00:00
|
|
|
char ishftl();
|
|
|
|
|
2020-10-06 16:30:20 +00:00
|
|
|
/* Integer Shift Right *
|
|
|
|
* Args: char n - Number of Bits *
|
|
|
|
* int w - Value to Shift *
|
|
|
|
* Returns: char v - Overflow Bits *
|
|
|
|
int r - Shifted Integer */
|
2019-05-27 21:12:10 +00:00
|
|
|
char ishftr();
|
|
|
|
|
2020-10-06 16:30:20 +00:00
|
|
|
/* Integer Subtract *
|
2019-05-27 21:12:10 +00:00
|
|
|
* Requires: setsrc(m) - Minuend *
|
2020-10-06 16:30:20 +00:00
|
|
|
* Args: int s - Subtrahend *
|
|
|
|
* Returns: char c - Carry *
|
|
|
|
* int d - Difference */
|
2019-05-27 21:12:10 +00:00
|
|
|
char isub();
|