Introduction #
The Propeller 2 can use these libraries to handle 64/96/128-Bit Unsigned Integer Math!
For the latest version of the full library, visit our OBEX link in resources!
Methods #
These methods are included in 64, 96 and 128 bit versions! To download the methods, visit our OBEX link in resources!
| Method name | Description |
|---|---|
| FloatingNEGQ() | negate |
| ADDQ() | add |
| SUBQ() | subtract |
| CMPQ() | compare |
| MAGQ() | magnitude |
| SHLQ() | shift left |
| SHRQ() | shift right |
| MULQ() | multiply |
| DIVQ() | divide |
| LOGQ() | log2 |
| EXPQ() | exp2 |
| LongLSB() | extract long via LSB |
| LongMSB() | extract long via MSB |
| LongSHL() | left-shift long to make 64/96/128-bit value-point conversion methods |
Code Snippets #
These two snippets demonstrate the add methods for 64-bit and 128-bit
PUB addq(int64 a, int64 b) : int64 r
'' 64-bit add
org
mov r+0,a+0
mov r+1,a+1
add r+0,b+0 wc
addx r+1,b+1
end
PUB addq(int128 a, int128 b) : int128 r
'' 128-bit add
org
mov r+0,a+0
mov r+1,a+1
mov r+2,a+2
mov r+3,a+3
add r+0,b+0 wc
addx r+1,b+1 wc
addx r+2,b+2 wc
addx r+3,b+3
end
Resources #
Parallax Propeller 2 - Spin2 Language Documentation