| zsplit.3 - libzahl - big integer library | |
| git clone git://git.suckless.org/libzahl | |
| Log | |
| Files | |
| Refs | |
| README | |
| LICENSE | |
| --- | |
| zsplit.3 (744B) | |
| --- | |
| 1 .TH ZSPLIT 3 libzahl | |
| 2 .SH NAME | |
| 3 zsplit - Split a big integer in two parts | |
| 4 .SH SYNOPSIS | |
| 5 .nf | |
| 6 #include <zahl.h> | |
| 7 | |
| 8 void zsplit(z_t \fIhigh\fP, z_t \fIlow\fP, z_t \fIa\fP, size_t \fIn\fP); | |
| 9 .fi | |
| 10 .SH DESCRIPTION | |
| 11 .B zsplits | |
| 12 splits | |
| 13 .I a | |
| 14 into two parts. The lowest | |
| 15 .I n | |
| 16 bits are stored in | |
| 17 .IR low , | |
| 18 and the rest of the bits are | |
| 19 stored in | |
| 20 .IR high . | |
| 21 The result stored in | |
| 22 .I high | |
| 23 is shifted | |
| 24 .I n | |
| 25 bits to the right. Both | |
| 26 .I high | |
| 27 and | |
| 28 .I low | |
| 29 will have the same sign as | |
| 30 .IR a . | |
| 31 .P | |
| 32 It is safe to call | |
| 33 .B zsplit | |
| 34 with | |
| 35 .I "(high==a)" | |
| 36 and | |
| 37 .IR "(low==a)" . | |
| 38 .SH RATIONALE | |
| 39 Splitting big integers in the described way is useful | |
| 40 for divide-and-conquer algorithms. | |
| 41 .SH SEE ALSO | |
| 42 .BR zand (3), | |
| 43 .BR zor (3), | |
| 44 .BR zxor (3), | |
| 45 .BR znot (3), | |
| 46 .BR zlsh (3), | |
| 47 .BR zrsh (3), | |
| 48 .BR zbits (3) |