xref: /optee_os/lib/libutils/isoc/arch/arm/softfloat/source/include/primitives.h (revision 9403c583381528e7fb391e3769644cc9653cfbb6)
1 
2 /*============================================================================
3 
4 This C header file is part of the SoftFloat IEEE Floating-Point Arithmetic
5 Package, Release 3a, by John R. Hauser.
6 
7 Copyright 2011, 2012, 2013, 2014 The Regents of the University of California.
8 All rights reserved.
9 
10 Redistribution and use in source and binary forms, with or without
11 modification, are permitted provided that the following conditions are met:
12 
13  1. Redistributions of source code must retain the above copyright notice,
14     this list of conditions, and the following disclaimer.
15 
16  2. Redistributions in binary form must reproduce the above copyright notice,
17     this list of conditions, and the following disclaimer in the documentation
18     and/or other materials provided with the distribution.
19 
20  3. Neither the name of the University nor the names of its contributors may
21     be used to endorse or promote products derived from this software without
22     specific prior written permission.
23 
24 THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY
25 EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
26 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE
27 DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
28 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
29 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
30 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
31 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
33 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 
35 =============================================================================*/
36 
37 #ifndef primitives_h
38 #define primitives_h 1
39 
40 #include <stdbool.h>
41 #include <stdint.h>
42 #include "primitiveTypes.h"
43 
44 #ifndef softfloat_shortShiftRightJam64
45 /*----------------------------------------------------------------------------
46 | Shifts `a' right by the number of bits given in `count', which must be in
47 | the range 1 to 63.  If any nonzero bits are shifted off, they are "jammed"
48 | into the least-significant bit of the shifted value by setting the least-
49 | significant bit to 1.  This shifted-and-jammed value is returned.
50 *----------------------------------------------------------------------------*/
51 #if defined INLINE_LEVEL && (2 <= INLINE_LEVEL)
52 INLINE
53  uint64_t softfloat_shortShiftRightJam64( uint64_t a, uint_fast8_t count )
54     { return a>>count | ((a & (((uint_fast64_t) 1<<count) - 1)) != 0); }
55 #else
56 uint64_t softfloat_shortShiftRightJam64( uint64_t a, uint_fast8_t count );
57 #endif
58 #endif
59 
60 #ifndef softfloat_shiftRightJam32
61 /*----------------------------------------------------------------------------
62 | Shifts `a' right by the number of bits given in `count', which must not
63 | be zero.  If any nonzero bits are shifted off, they are "jammed" into the
64 | least-significant bit of the shifted value by setting the least-significant
65 | bit to 1.  This shifted-and-jammed value is returned.
66 |   The value of `count' can be arbitrarily large.  In particular, if `count'
67 | is greater than 32, the result will be either 0 or 1, depending on whether
68 | `a' is zero or nonzero.
69 *----------------------------------------------------------------------------*/
70 #if defined INLINE_LEVEL && (2 <= INLINE_LEVEL)
71 INLINE uint32_t softfloat_shiftRightJam32( uint32_t a, uint_fast16_t count )
72 {
73     return
74         (count < 31) ? a>>count | ((uint32_t) (a<<(-count & 31)) != 0)
75             : (a != 0);
76 }
77 #else
78 uint32_t softfloat_shiftRightJam32( uint32_t a, uint_fast16_t count );
79 #endif
80 #endif
81 
82 #ifndef softfloat_shiftRightJam64
83 /*----------------------------------------------------------------------------
84 | Shifts `a' right by the number of bits given in `count', which must not
85 | be zero.  If any nonzero bits are shifted off, they are "jammed" into the
86 | least-significant bit of the shifted value by setting the least-significant
87 | bit to 1.  This shifted-and-jammed value is returned.
88 |   The value of `count' can be arbitrarily large.  In particular, if `count'
89 | is greater than 64, the result will be either 0 or 1, depending on whether
90 | `a' is zero or nonzero.
91 *----------------------------------------------------------------------------*/
92 #if defined INLINE_LEVEL && (3 <= INLINE_LEVEL)
93 INLINE uint64_t softfloat_shiftRightJam64( uint64_t a, uint_fast32_t count )
94 {
95     return
96         (count < 63) ? a>>count | ((uint64_t) (a<<(-count & 63)) != 0)
97             : (a != 0);
98 }
99 #else
100 uint64_t softfloat_shiftRightJam64( uint64_t a, uint_fast32_t count );
101 #endif
102 #endif
103 
104 /*----------------------------------------------------------------------------
105 | A constant table that translates an 8-bit unsigned integer (the array index)
106 | into the number of leading 0 bits before the most-significant 1 of that
107 | integer.  For integer zero (index 0), the corresponding table element is 8.
108 *----------------------------------------------------------------------------*/
109 extern const uint_least8_t softfloat_countLeadingZeros8[256];
110 
111 #ifndef softfloat_countLeadingZeros32
112 /*----------------------------------------------------------------------------
113 | Returns the number of leading 0 bits before the most-significant 1 bit of
114 | `a'.  If `a' is zero, 32 is returned.
115 *----------------------------------------------------------------------------*/
116 #if defined INLINE_LEVEL && (3 <= INLINE_LEVEL)
117 INLINE uint_fast8_t softfloat_countLeadingZeros32( uint32_t a )
118 {
119     uint_fast8_t count = 0;
120     if ( a < 0x10000 ) {
121         count = 16;
122         a <<= 16;
123     }
124     if ( a < 0x1000000 ) {
125         count += 8;
126         a <<= 8;
127     }
128     count += softfloat_countLeadingZeros8[a>>24];
129     return count;
130 }
131 #else
132 uint_fast8_t softfloat_countLeadingZeros32( uint32_t a );
133 #endif
134 #endif
135 
136 #ifndef softfloat_countLeadingZeros64
137 /*----------------------------------------------------------------------------
138 | Returns the number of leading 0 bits before the most-significant 1 bit of
139 | `a'.  If `a' is zero, 64 is returned.
140 *----------------------------------------------------------------------------*/
141 uint_fast8_t softfloat_countLeadingZeros64( uint64_t a );
142 #endif
143 
144 #ifndef softfloat_approxRecip32_1
145 /*----------------------------------------------------------------------------
146 | Returns an approximation to the reciprocal of the number represented by `a',
147 | where `a' is interpreted as an unsigned fixed-point number with one integer
148 | bit and 31 fraction bits.  The `a' input must be "normalized", meaning that
149 | its most-significant bit (bit 31) must be 1.  Thus, if A is the value of
150 | the fixed-point interpretation of `a', then 1 <= A < 2.  The returned value
151 | is interpreted as a pure unsigned fraction, having no integer bits and 32
152 | fraction bits.  The approximation returned is never greater than the true
153 | reciprocal 1/A, and it differs from the true reciprocal by at most 2.006 ulp
154 | (units in the last place).
155 *----------------------------------------------------------------------------*/
156 #ifdef SOFTFLOAT_FAST_DIV64TO32
157 #define softfloat_approxRecip32_1( a ) ((uint32_t) (UINT64_C( 0x7FFFFFFFFFFFFFFF ) / (uint32_t) (a)))
158 #else
159 uint32_t softfloat_approxRecip32_1( uint32_t a );
160 #endif
161 #endif
162 
163 #ifndef softfloat_approxRecipSqrt32_1
164 /*----------------------------------------------------------------------------
165 | Returns an approximation to the reciprocal of the square root of the number
166 | represented by `a', where `a' is interpreted as an unsigned fixed-point
167 | number either with one integer bit and 31 fraction bits or with two integer
168 | bits and 30 fraction bits.  The format of `a' is determined by `oddExpA',
169 | which must be either 0 or 1.  If `oddExpA' is 1, `a' is interpreted as
170 | having one integer bit, and if `oddExpA' is 0, `a' is interpreted as having
171 | two integer bits.  The `a' input must be "normalized", meaning that its
172 | most-significant bit (bit 31) must be 1.  Thus, if A is the value of the
173 | fixed-point interpretation of `a', it follows that 1 <= A < 2 when `oddExpA'
174 | is 1, and 2 <= A < 4 when `oddExpA' is 0.
175 |   The returned value is interpreted as a pure unsigned fraction, having
176 | no integer bits and 32 fraction bits.  The approximation returned is never
177 | greater than the true reciprocal 1/sqrt(A), and it differs from the true
178 | reciprocal by at most 2.06 ulp (units in the last place).  The approximation
179 | returned is also always within the range 0.5 to 1; thus, the most-
180 | significant bit of the result is always set.
181 *----------------------------------------------------------------------------*/
182 uint32_t softfloat_approxRecipSqrt32_1( unsigned int oddExpA, uint32_t a );
183 #endif
184 
185 #ifdef SOFTFLOAT_FAST_INT64
186 
187 /*----------------------------------------------------------------------------
188 | The following functions are needed only when `SOFTFLOAT_FAST_INT64' is
189 | defined.
190 *----------------------------------------------------------------------------*/
191 
192 #ifndef softfloat_eq128
193 /*----------------------------------------------------------------------------
194 | Returns true if the 128-bit unsigned integer formed by concatenating `a64'
195 | and `a0' is equal to the 128-bit unsigned integer formed by concatenating
196 | `b64' and `b0'.
197 *----------------------------------------------------------------------------*/
198 #if defined INLINE_LEVEL && (1 <= INLINE_LEVEL)
199 INLINE
200  bool softfloat_eq128( uint64_t a64, uint64_t a0, uint64_t b64, uint64_t b0 )
201     { return (a64 == b64) && (a0 == b0); }
202 #else
203 bool softfloat_eq128( uint64_t a64, uint64_t a0, uint64_t b64, uint64_t b0 );
204 #endif
205 #endif
206 
207 #ifndef softfloat_le128
208 /*----------------------------------------------------------------------------
209 | Returns true if the 128-bit unsigned integer formed by concatenating `a64'
210 | and `a0' is less than or equal to the 128-bit unsigned integer formed by
211 | concatenating `b64' and `b0'.
212 *----------------------------------------------------------------------------*/
213 #if defined INLINE_LEVEL && (2 <= INLINE_LEVEL)
214 INLINE
215  bool softfloat_le128( uint64_t a64, uint64_t a0, uint64_t b64, uint64_t b0 )
216     { return (a64 < b64) || ((a64 == b64) && (a0 <= b0)); }
217 #else
218 bool softfloat_le128( uint64_t a64, uint64_t a0, uint64_t b64, uint64_t b0 );
219 #endif
220 #endif
221 
222 #ifndef softfloat_lt128
223 /*----------------------------------------------------------------------------
224 | Returns true if the 128-bit unsigned integer formed by concatenating `a64'
225 | and `a0' is less than the 128-bit unsigned integer formed by concatenating
226 | `b64' and `b0'.
227 *----------------------------------------------------------------------------*/
228 #if defined INLINE_LEVEL && (2 <= INLINE_LEVEL)
229 INLINE
230  bool softfloat_lt128( uint64_t a64, uint64_t a0, uint64_t b64, uint64_t b0 )
231     { return (a64 < b64) || ((a64 == b64) && (a0 < b0)); }
232 #else
233 bool softfloat_lt128( uint64_t a64, uint64_t a0, uint64_t b64, uint64_t b0 );
234 #endif
235 #endif
236 
237 #ifndef softfloat_shortShiftLeft128
238 /*----------------------------------------------------------------------------
239 | Shifts the 128 bits formed by concatenating `a64' and `a0' left by the
240 | number of bits given in `count', which must be in the range 1 to 63.
241 *----------------------------------------------------------------------------*/
242 #if defined INLINE_LEVEL && (2 <= INLINE_LEVEL)
243 INLINE
244  struct uint128
245   softfloat_shortShiftLeft128( uint64_t a64, uint64_t a0, uint_fast8_t count )
246 {
247     struct uint128 z;
248     z.v64 = a64<<count | a0>>(-count & 63);
249     z.v0 = a0<<count;
250     return z;
251 }
252 #else
253 struct uint128
254  softfloat_shortShiftLeft128( uint64_t a64, uint64_t a0, uint_fast8_t count );
255 #endif
256 #endif
257 
258 #ifndef softfloat_shortShiftRight128
259 /*----------------------------------------------------------------------------
260 | Shifts the 128 bits formed by concatenating `a64' and `a0' right by the
261 | number of bits given in `count', which must be in the range 1 to 63.
262 *----------------------------------------------------------------------------*/
263 #if defined INLINE_LEVEL && (2 <= INLINE_LEVEL)
264 INLINE
265  struct uint128
266   softfloat_shortShiftRight128( uint64_t a64, uint64_t a0, uint_fast8_t count )
267 {
268     struct uint128 z;
269     z.v64 = a64>>count;
270     z.v0 = a64<<(-count & 63) | a0>>count;
271     return z;
272 }
273 #else
274 struct uint128
275  softfloat_shortShiftRight128( uint64_t a64, uint64_t a0, uint_fast8_t count );
276 #endif
277 #endif
278 
279 #ifndef softfloat_shortShiftRightJam64Extra
280 /*----------------------------------------------------------------------------
281 | This function is the same as `softfloat_shiftRightJam64Extra' (below),
282 | except that `count' must be in the range 1 to 63.
283 *----------------------------------------------------------------------------*/
284 #if defined INLINE_LEVEL && (2 <= INLINE_LEVEL)
285 INLINE
286  struct uint64_extra
287   softfloat_shortShiftRightJam64Extra(
288       uint64_t a, uint64_t extra, uint_fast8_t count )
289 {
290     struct uint64_extra z;
291     z.v = a>>count;
292     z.extra = a<<(-count & 63) | (extra != 0);
293     return z;
294 }
295 #else
296 struct uint64_extra
297  softfloat_shortShiftRightJam64Extra(
298      uint64_t a, uint64_t extra, uint_fast8_t count );
299 #endif
300 #endif
301 
302 #ifndef softfloat_shortShiftRightJam128
303 /*----------------------------------------------------------------------------
304 | Shifts the 128 bits formed by concatenating `a64' and `a0' right by the
305 | number of bits given in `count', which must be in the range 1 to 63.  If any
306 | nonzero bits are shifted off, they are "jammed" into the least-significant
307 | bit of the shifted value by setting the least-significant bit to 1.  This
308 | shifted-and-jammed value is returned.
309 *----------------------------------------------------------------------------*/
310 #if defined INLINE_LEVEL && (3 <= INLINE_LEVEL)
311 INLINE
312  struct uint128
313   softfloat_shortShiftRightJam128(
314       uint64_t a64, uint64_t a0, uint_fast8_t count )
315 {
316     uint_fast8_t negCount = -count;
317     struct uint128 z;
318     z.v64 = a64>>count;
319     z.v0 =
320         a64<<(negCount & 63) | a0>>count
321             | ((uint64_t) (a0<<(negCount & 63)) != 0);
322     return z;
323 }
324 #else
325 struct uint128
326  softfloat_shortShiftRightJam128(
327      uint64_t a64, uint64_t a0, uint_fast8_t count );
328 #endif
329 #endif
330 
331 #ifndef softfloat_shortShiftRightJam128Extra
332 /*----------------------------------------------------------------------------
333 | This function is the same as `softfloat_shiftRightJam128Extra' (below),
334 | except that `count' must be in the range 1 to 63.
335 *----------------------------------------------------------------------------*/
336 #if defined INLINE_LEVEL && (3 <= INLINE_LEVEL)
337 INLINE
338  struct uint128_extra
339   softfloat_shortShiftRightJam128Extra(
340       uint64_t a64, uint64_t a0, uint64_t extra, uint_fast8_t count )
341 {
342     uint_fast8_t negCount = -count;
343     struct uint128_extra z;
344     z.v.v64 = a64>>count;
345     z.v.v0 = a64<<(negCount & 63) | a0>>count;
346     z.extra = a0<<(negCount & 63) | (extra != 0);
347     return z;
348 }
349 #else
350 struct uint128_extra
351  softfloat_shortShiftRightJam128Extra(
352      uint64_t a64, uint64_t a0, uint64_t extra, uint_fast8_t count );
353 #endif
354 #endif
355 
356 #ifndef softfloat_shiftRightJam64Extra
357 /*----------------------------------------------------------------------------
358 | Shifts the 128 bits formed by concatenating `a' and `extra' right by 64
359 | _plus_ the number of bits given in `count', which must not be zero.  This
360 | shifted value is at most 64 nonzero bits and is returned in the `v' field
361 | of the `struct uint64_extra' result.  The 64-bit `extra' field of the result
362 | contains a value formed as follows from the bits that were shifted off:  The
363 | _last_ bit shifted off is the most-significant bit of the `extra' field, and
364 | the other 63 bits of the `extra' field are all zero if and only if _all_but_
365 | _the_last_ bits shifted off were all zero.
366 |   (This function makes more sense if `a' and `extra' are considered to form
367 | an unsigned fixed-point number with binary point between `a' and `extra'.
368 | This fixed-point value is shifted right by the number of bits given in
369 | `count', and the integer part of this shifted value is returned in the `v'
370 | field of the result.  The fractional part of the shifted value is modified
371 | as described above and returned in the `extra' field of the result.)
372 *----------------------------------------------------------------------------*/
373 #if defined INLINE_LEVEL && (4 <= INLINE_LEVEL)
374 INLINE
375  struct uint64_extra
376   softfloat_shiftRightJam64Extra(
377       uint64_t a, uint64_t extra, uint_fast32_t count )
378 {
379     struct uint64_extra z;
380     if ( count < 64 ) {
381         z.v = a>>count;
382         z.extra = a<<(-count & 63);
383     } else {
384         z.v = 0;
385         z.extra = (count == 64) ? a : (a != 0);
386     }
387     z.extra |= (extra != 0);
388     return z;
389 }
390 #else
391 struct uint64_extra
392  softfloat_shiftRightJam64Extra(
393      uint64_t a, uint64_t extra, uint_fast32_t count );
394 #endif
395 #endif
396 
397 #ifndef softfloat_shiftRightJam128
398 /*----------------------------------------------------------------------------
399 | Shifts the 128 bits formed by concatenating `a64' and `a0' right by the
400 | number of bits given in `count', which must not be zero.  If any nonzero
401 | bits are shifted off, they are "jammed" into the least-significant bit of
402 | the shifted value by setting the least-significant bit to 1.  This shifted-
403 | and-jammed value is returned.
404 |   The value of `count' can be arbitrarily large.  In particular, if `count'
405 | is greater than 128, the result will be either 0 or 1, depending on whether
406 | the original 128 bits are all zeros.
407 *----------------------------------------------------------------------------*/
408 struct uint128
409  softfloat_shiftRightJam128( uint64_t a64, uint64_t a0, uint_fast32_t count );
410 #endif
411 
412 #ifndef softfloat_shiftRightJam128Extra
413 /*----------------------------------------------------------------------------
414 | Shifts the 192 bits formed by concatenating `a64', `a0', and `extra' right
415 | by 64 _plus_ the number of bits given in `count', which must not be zero.
416 | This shifted value is at most 128 nonzero bits and is returned in the `v'
417 | field of the `struct uint128_extra' result.  The 64-bit `extra' field of the
418 | result contains a value formed as follows from the bits that were shifted
419 | off:  The _last_ bit shifted off is the most-significant bit of the `extra'
420 | field, and the other 63 bits of the `extra' field are all zero if and only
421 | if _all_but_the_last_ bits shifted off were all zero.
422 |   (This function makes more sense if `a64', `a0', and `extra' are considered
423 | to form an unsigned fixed-point number with binary point between `a0' and
424 | `extra'.  This fixed-point value is shifted right by the number of bits
425 | given in `count', and the integer part of this shifted value is returned
426 | in the `v' field of the result.  The fractional part of the shifted value
427 | is modified as described above and returned in the `extra' field of the
428 | result.)
429 *----------------------------------------------------------------------------*/
430 struct uint128_extra
431  softfloat_shiftRightJam128Extra(
432      uint64_t a64, uint64_t a0, uint64_t extra, uint_fast32_t count );
433 #endif
434 
435 #ifndef softfloat_shiftRightJam256M
436 /*----------------------------------------------------------------------------
437 | Shifts the 256-bit unsigned integer pointed to by `aPtr' right by the number
438 | of bits given in `count', which must not be zero.  If any nonzero bits are
439 | shifted off, they are "jammed" into the least-significant bit of the shifted
440 | value by setting the least-significant bit to 1.  This shifted-and-jammed
441 | value is stored at the location pointed to by `zPtr'.  Each of `aPtr' and
442 | `zPtr' points to an array of four 64-bit elements that concatenate in the
443 | platform's normal endian order to form a 256-bit integer.
444 |   The value of `count' can be arbitrarily large.  In particular, if `count'
445 | is greater than 256, the stored result will be either 0 or 1, depending on
446 | whether the original 256 bits are all zeros.
447 *----------------------------------------------------------------------------*/
448 void
449  softfloat_shiftRightJam256M(
450      const uint64_t *aPtr, uint_fast32_t count, uint64_t *zPtr );
451 #endif
452 
453 #ifndef softfloat_add128
454 /*----------------------------------------------------------------------------
455 | Returns the sum of the 128-bit integer formed by concatenating `a64' and
456 | `a0' and the 128-bit integer formed by concatenating `b64' and `b0'.  The
457 | addition is modulo 2^128, so any carry out is lost.
458 *----------------------------------------------------------------------------*/
459 #if defined INLINE_LEVEL && (2 <= INLINE_LEVEL)
460 INLINE
461  struct uint128
462   softfloat_add128( uint64_t a64, uint64_t a0, uint64_t b64, uint64_t b0 )
463 {
464     struct uint128 z;
465     z.v0 = a0 + b0;
466     z.v64 = a64 + b64 + (z.v0 < a0);
467     return z;
468 }
469 #else
470 struct uint128
471  softfloat_add128( uint64_t a64, uint64_t a0, uint64_t b64, uint64_t b0 );
472 #endif
473 #endif
474 
475 #ifndef softfloat_add256M
476 /*----------------------------------------------------------------------------
477 | Adds the two 256-bit integers pointed to by `aPtr' and `bPtr'.  The addition
478 | is modulo 2^256, so any carry out is lost.  The sum is stored at the
479 | location pointed to by `zPtr'.  Each of `aPtr', `bPtr', and `zPtr' points to
480 | an array of four 64-bit elements that concatenate in the platform's normal
481 | endian order to form a 256-bit integer.
482 *----------------------------------------------------------------------------*/
483 void
484  softfloat_add256M(
485      const uint64_t *aPtr, const uint64_t *bPtr, uint64_t *zPtr );
486 #endif
487 
488 #ifndef softfloat_sub128
489 /*----------------------------------------------------------------------------
490 | Returns the difference of the 128-bit integer formed by concatenating `a64'
491 | and `a0' and the 128-bit integer formed by concatenating `b64' and `b0'.
492 | The subtraction is modulo 2^128, so any borrow out (carry out) is lost.
493 *----------------------------------------------------------------------------*/
494 #if defined INLINE_LEVEL && (2 <= INLINE_LEVEL)
495 INLINE
496  struct uint128
497   softfloat_sub128( uint64_t a64, uint64_t a0, uint64_t b64, uint64_t b0 )
498 {
499     struct uint128 z;
500     z.v0 = a0 - b0;
501     z.v64 = a64 - b64;
502     z.v64 -= (a0 < b0);
503     return z;
504 }
505 #else
506 struct uint128
507  softfloat_sub128( uint64_t a64, uint64_t a0, uint64_t b64, uint64_t b0 );
508 #endif
509 #endif
510 
511 #ifndef softfloat_sub256M
512 /*----------------------------------------------------------------------------
513 | Subtracts the 256-bit integer pointed to by `bPtr' from the 256-bit integer
514 | pointed to by `aPtr'.  The addition is modulo 2^256, so any borrow out
515 | (carry out) is lost.  The difference is stored at the location pointed to
516 | by `zPtr'.  Each of `aPtr', `bPtr', and `zPtr' points to an array of four
517 | 64-bit elements that concatenate in the platform's normal endian order to
518 | form a 256-bit integer.
519 *----------------------------------------------------------------------------*/
520 void
521  softfloat_sub256M(
522      const uint64_t *aPtr, const uint64_t *bPtr, uint64_t *zPtr );
523 #endif
524 
525 #ifndef softfloat_mul64ByShifted32To128
526 /*----------------------------------------------------------------------------
527 | Returns the 128-bit product of `a', `b', and 2^32.
528 *----------------------------------------------------------------------------*/
529 #if defined INLINE_LEVEL && (3 <= INLINE_LEVEL)
530 INLINE struct uint128 softfloat_mul64ByShifted32To128( uint64_t a, uint32_t b )
531 {
532     uint_fast64_t mid;
533     struct uint128 z;
534     mid = (uint_fast64_t) (uint32_t) a * b;
535     z.v0 = mid<<32;
536     z.v64 = (uint_fast64_t) (uint32_t) (a>>32) * b + (mid>>32);
537     return z;
538 }
539 #else
540 struct uint128 softfloat_mul64ByShifted32To128( uint64_t a, uint32_t b );
541 #endif
542 #endif
543 
544 #ifndef softfloat_mul64To128
545 /*----------------------------------------------------------------------------
546 | Returns the 128-bit product of `a' and `b'.
547 *----------------------------------------------------------------------------*/
548 struct uint128 softfloat_mul64To128( uint64_t a, uint64_t b );
549 #endif
550 
551 #ifndef softfloat_mul128By32
552 /*----------------------------------------------------------------------------
553 | Returns the product of the 128-bit integer formed by concatenating `a64' and
554 | `a0', multiplied by `b'.  The multiplication is modulo 2^128; any overflow
555 | bits are discarded.
556 *----------------------------------------------------------------------------*/
557 #if defined INLINE_LEVEL && (4 <= INLINE_LEVEL)
558 INLINE
559  struct uint128 softfloat_mul128By32( uint64_t a64, uint64_t a0, uint32_t b )
560 {
561     struct uint128 z;
562     uint_fast64_t mid;
563     uint_fast32_t carry;
564     z.v0 = a0 * b;
565     mid = (uint_fast64_t) (uint32_t) (a0>>32) * b;
566     carry = (uint32_t) ((uint_fast32_t) (z.v0>>32) - (uint_fast32_t) mid);
567     z.v64 = a64 * b + (uint_fast32_t) ((mid + carry)>>32);
568     return z;
569 }
570 #else
571 struct uint128 softfloat_mul128By32( uint64_t a64, uint64_t a0, uint32_t b );
572 #endif
573 #endif
574 
575 #ifndef softfloat_mul128To256M
576 /*----------------------------------------------------------------------------
577 | Multiplies the 128-bit unsigned integer formed by concatenating `a64' and
578 | `a0' by the 128-bit unsigned integer formed by concatenating `b64' and
579 | `b0'.  The 256-bit product is stored at the location pointed to by `zPtr'.
580 | Argument `zPtr' points to an array of four 64-bit elements that concatenate
581 | in the platform's normal endian order to form a 256-bit integer.
582 *----------------------------------------------------------------------------*/
583 void
584  softfloat_mul128To256M(
585      uint64_t a64, uint64_t a0, uint64_t b64, uint64_t b0, uint64_t *zPtr );
586 #endif
587 
588 #else
589 
590 /*----------------------------------------------------------------------------
591 | The following functions are needed only when `SOFTFLOAT_FAST_INT64' is not
592 | defined.
593 *----------------------------------------------------------------------------*/
594 
595 #ifndef softfloat_compare96M
596 /*----------------------------------------------------------------------------
597 | Compares the two 96-bit unsigned integers pointed to by `aPtr' and `bPtr'.
598 | Returns -1 if the first integer (A) is less than the second (B); returns 0
599 | if the two integers are equal; and returns +1 if the first integer (A)
600 | is greater than the second (B).  (The result is thus the signum of A - B.)
601 | Each of `aPtr' and `bPtr' points to an array of three 32-bit elements that
602 | concatenate in the platform's normal endian order to form a 96-bit integer.
603 *----------------------------------------------------------------------------*/
604 int_fast8_t softfloat_compare96M( const uint32_t *aPtr, const uint32_t *bPtr );
605 #endif
606 
607 #ifndef softfloat_compare128M
608 /*----------------------------------------------------------------------------
609 | Compares the two 128-bit unsigned integers pointed to by `aPtr' and `bPtr'.
610 | Returns -1 if the first integer (A) is less than the second (B); returns 0
611 | if the two integers are equal; and returns +1 if the first integer (A)
612 | is greater than the second (B).  (The result is thus the signum of A - B.)
613 | Each of `aPtr' and `bPtr' points to an array of four 32-bit elements that
614 | concatenate in the platform's normal endian order to form a 128-bit integer.
615 *----------------------------------------------------------------------------*/
616 int_fast8_t
617  softfloat_compare128M( const uint32_t *aPtr, const uint32_t *bPtr );
618 #endif
619 
620 #ifndef softfloat_shortShiftLeft64To96M
621 /*----------------------------------------------------------------------------
622 | Extends `a' to 96 bits and shifts the value left by the number of bits given
623 | in `count', which must be in the range 1 to 31.  The result is stored at the
624 | location pointed to by `zPtr'.  Argument `zPtr' points to an array of three
625 | 32-bit elements that concatenate in the platform's normal endian order to
626 | form a 96-bit integer.
627 *----------------------------------------------------------------------------*/
628 #if defined INLINE_LEVEL && (2 <= INLINE_LEVEL)
629 INLINE
630  void
631   softfloat_shortShiftLeft64To96M(
632       uint64_t a, uint_fast8_t count, uint32_t *zPtr )
633 {
634     zPtr[indexWord( 3, 0 )] = (uint32_t) a<<count;
635     a >>= 32 - count;
636     zPtr[indexWord( 3, 2 )] = a>>32;
637     zPtr[indexWord( 3, 1 )] = a;
638 }
639 #else
640 void
641  softfloat_shortShiftLeft64To96M(
642      uint64_t a, uint_fast8_t count, uint32_t *zPtr );
643 #endif
644 #endif
645 
646 #ifndef softfloat_shortShiftLeftM
647 /*----------------------------------------------------------------------------
648 | Shifts the N-bit unsigned integer pointed to by `aPtr' left by the number
649 | of bits given in `count', where N = `size_words' * 32.  The value of `count'
650 | must be in the range 1 to 31.  Any nonzero bits shifted off are lost.  The
651 | shifted N-bit result is stored at the location pointed to by `zPtr'.  Each
652 | of `aPtr' and `zPtr' points to a `size_words'-long array of 32-bit elements
653 | that concatenate in the platform's normal endian order to form an N-bit
654 | integer.
655 *----------------------------------------------------------------------------*/
656 void
657  softfloat_shortShiftLeftM(
658      uint_fast8_t size_words,
659      const uint32_t *aPtr,
660      uint_fast8_t count,
661      uint32_t *zPtr
662  );
663 #endif
664 
665 #ifndef softfloat_shortShiftLeft96M
666 /*----------------------------------------------------------------------------
667 | This function or macro is the same as `softfloat_shortShiftLeftM' with
668 | `size_words' = 3 (N = 96).
669 *----------------------------------------------------------------------------*/
670 #define softfloat_shortShiftLeft96M( aPtr, count, zPtr ) softfloat_shortShiftLeftM( 3, aPtr, count, zPtr )
671 #endif
672 
673 #ifndef softfloat_shortShiftLeft128M
674 /*----------------------------------------------------------------------------
675 | This function or macro is the same as `softfloat_shortShiftLeftM' with
676 | `size_words' = 4 (N = 128).
677 *----------------------------------------------------------------------------*/
678 #define softfloat_shortShiftLeft128M( aPtr, count, zPtr ) softfloat_shortShiftLeftM( 4, aPtr, count, zPtr )
679 #endif
680 
681 #ifndef softfloat_shortShiftLeft160M
682 /*----------------------------------------------------------------------------
683 | This function or macro is the same as `softfloat_shortShiftLeftM' with
684 | `size_words' = 5 (N = 160).
685 *----------------------------------------------------------------------------*/
686 #define softfloat_shortShiftLeft160M( aPtr, count, zPtr ) softfloat_shortShiftLeftM( 5, aPtr, count, zPtr )
687 #endif
688 
689 #ifndef softfloat_shiftLeftM
690 /*----------------------------------------------------------------------------
691 | Shifts the N-bit unsigned integer pointed to by `aPtr' left by the number
692 | of bits given in `count', where N = `size_words' * 32.  The value of `count'
693 | must not be zero.  Any nonzero bits shifted off are lost.  The shifted
694 | N-bit result is stored at the location pointed to by `zPtr'.  Each of `aPtr'
695 | and `zPtr' points to a `size_words'-long array of 32-bit elements that
696 | concatenate in the platform's normal endian order to form an N-bit integer.
697 |   The value of `count' can be arbitrarily large.  In particular, if `count'
698 | is greater than N, the stored result will be 0.
699 *----------------------------------------------------------------------------*/
700 void
701  softfloat_shiftLeftM(
702      uint_fast8_t size_words,
703      const uint32_t *aPtr,
704      uint32_t count,
705      uint32_t *zPtr
706  );
707 #endif
708 
709 #ifndef softfloat_shiftLeft96M
710 /*----------------------------------------------------------------------------
711 | This function or macro is the same as `softfloat_shiftLeftM' with
712 | `size_words' = 3 (N = 96).
713 *----------------------------------------------------------------------------*/
714 #define softfloat_shiftLeft96M( aPtr, count, zPtr ) softfloat_shiftLeftM( 3, aPtr, count, zPtr )
715 #endif
716 
717 #ifndef softfloat_shiftLeft128M
718 /*----------------------------------------------------------------------------
719 | This function or macro is the same as `softfloat_shiftLeftM' with
720 | `size_words' = 4 (N = 128).
721 *----------------------------------------------------------------------------*/
722 #define softfloat_shiftLeft128M( aPtr, count, zPtr ) softfloat_shiftLeftM( 4, aPtr, count, zPtr )
723 #endif
724 
725 #ifndef softfloat_shiftLeft160M
726 /*----------------------------------------------------------------------------
727 | This function or macro is the same as `softfloat_shiftLeftM' with
728 | `size_words' = 5 (N = 160).
729 *----------------------------------------------------------------------------*/
730 #define softfloat_shiftLeft160M( aPtr, count, zPtr ) softfloat_shiftLeftM( 5, aPtr, count, zPtr )
731 #endif
732 
733 #ifndef softfloat_shortShiftRightM
734 /*----------------------------------------------------------------------------
735 | Shifts the N-bit unsigned integer pointed to by `aPtr' right by the number
736 | of bits given in `count', where N = `size_words' * 32.  The value of `count'
737 | must be in the range 1 to 31.  Any nonzero bits shifted off are lost.  The
738 | shifted N-bit result is stored at the location pointed to by `zPtr'.  Each
739 | of `aPtr' and `zPtr' points to a `size_words'-long array of 32-bit elements
740 | that concatenate in the platform's normal endian order to form an N-bit
741 | integer.
742 *----------------------------------------------------------------------------*/
743 void
744  softfloat_shortShiftRightM(
745      uint_fast8_t size_words,
746      const uint32_t *aPtr,
747      uint_fast8_t count,
748      uint32_t *zPtr
749  );
750 #endif
751 
752 #ifndef softfloat_shortShiftRight128M
753 /*----------------------------------------------------------------------------
754 | This function or macro is the same as `softfloat_shortShiftRightM' with
755 | `size_words' = 4 (N = 128).
756 *----------------------------------------------------------------------------*/
757 #define softfloat_shortShiftRight128M( aPtr, count, zPtr ) softfloat_shortShiftRightM( 4, aPtr, count, zPtr )
758 #endif
759 
760 #ifndef softfloat_shortShiftRight160M
761 /*----------------------------------------------------------------------------
762 | This function or macro is the same as `softfloat_shortShiftRightM' with
763 | `size_words' = 5 (N = 160).
764 *----------------------------------------------------------------------------*/
765 #define softfloat_shortShiftRight160M( aPtr, count, zPtr ) softfloat_shortShiftRightM( 5, aPtr, count, zPtr )
766 #endif
767 
768 #ifndef softfloat_shortShiftRightJamM
769 /*----------------------------------------------------------------------------
770 | Shifts the N-bit unsigned integer pointed to by `aPtr' right by the number
771 | of bits given in `count', where N = `size_words' * 32.  The value of `count'
772 | must be in the range 1 to 31.  If any nonzero bits are shifted off, they are
773 | "jammed" into the least-significant bit of the shifted value by setting the
774 | least-significant bit to 1.  This shifted-and-jammed N-bit result is stored
775 | at the location pointed to by `zPtr'.  Each of `aPtr' and `zPtr' points
776 | to a `size_words'-long array of 32-bit elements that concatenate in the
777 | platform's normal endian order to form an N-bit integer.
778 *----------------------------------------------------------------------------*/
779 void
780  softfloat_shortShiftRightJamM(
781      uint_fast8_t, const uint32_t *, uint_fast8_t, uint32_t * );
782 #endif
783 
784 #ifndef softfloat_shortShiftRightJam160M
785 /*----------------------------------------------------------------------------
786 | This function or macro is the same as `softfloat_shortShiftRightJamM' with
787 | `size_words' = 5 (N = 160).
788 *----------------------------------------------------------------------------*/
789 #define softfloat_shortShiftRightJam160M( aPtr, count, zPtr ) softfloat_shortShiftRightJamM( 5, aPtr, count, zPtr )
790 #endif
791 
792 #ifndef softfloat_shiftRightM
793 /*----------------------------------------------------------------------------
794 | Shifts the N-bit unsigned integer pointed to by `aPtr' right by the number
795 | of bits given in `count', where N = `size_words' * 32.  The value of `count'
796 | must not be zero.  Any nonzero bits shifted off are lost.  The shifted
797 | N-bit result is stored at the location pointed to by `zPtr'.  Each of `aPtr'
798 | and `zPtr' points to a `size_words'-long array of 32-bit elements that
799 | concatenate in the platform's normal endian order to form an N-bit integer.
800 |   The value of `count' can be arbitrarily large.  In particular, if `count'
801 | is greater than N, the stored result will be 0.
802 *----------------------------------------------------------------------------*/
803 void
804  softfloat_shiftRightM(
805      uint_fast8_t size_words,
806      const uint32_t *aPtr,
807      uint32_t count,
808      uint32_t *zPtr
809  );
810 #endif
811 
812 #ifndef softfloat_shiftRight96M
813 /*----------------------------------------------------------------------------
814 | This function or macro is the same as `softfloat_shiftRightM' with
815 | `size_words' = 3 (N = 96).
816 *----------------------------------------------------------------------------*/
817 #define softfloat_shiftRight96M( aPtr, count, zPtr ) softfloat_shiftRightM( 3, aPtr, count, zPtr )
818 #endif
819 
820 #ifndef softfloat_shiftRightJamM
821 /*----------------------------------------------------------------------------
822 | Shifts the N-bit unsigned integer pointed to by `aPtr' right by the number
823 | of bits given in `count', where N = `size_words' * 32.  The value of `count'
824 | must not be zero.  If any nonzero bits are shifted off, they are "jammed"
825 | into the least-significant bit of the shifted value by setting the least-
826 | significant bit to 1.  This shifted-and-jammed N-bit result is stored
827 | at the location pointed to by `zPtr'.  Each of `aPtr' and `zPtr' points
828 | to a `size_words'-long array of 32-bit elements that concatenate in the
829 | platform's normal endian order to form an N-bit integer.
830 |   The value of `count' can be arbitrarily large.  In particular, if `count'
831 | is greater than N, the stored result will be either 0 or 1, depending on
832 | whether the original N bits are all zeros.
833 *----------------------------------------------------------------------------*/
834 void
835  softfloat_shiftRightJamM(
836      uint_fast8_t size_words,
837      const uint32_t *aPtr,
838      uint32_t count,
839      uint32_t *zPtr
840  );
841 #endif
842 
843 #ifndef softfloat_shiftRightJam96M
844 /*----------------------------------------------------------------------------
845 | This function or macro is the same as `softfloat_shiftRightJamM' with
846 | `size_words' = 3 (N = 96).
847 *----------------------------------------------------------------------------*/
848 #define softfloat_shiftRightJam96M( aPtr, count, zPtr ) softfloat_shiftRightJamM( 3, aPtr, count, zPtr )
849 #endif
850 
851 #ifndef softfloat_shiftRightJam128M
852 /*----------------------------------------------------------------------------
853 | This function or macro is the same as `softfloat_shiftRightJamM' with
854 | `size_words' = 4 (N = 128).
855 *----------------------------------------------------------------------------*/
856 #define softfloat_shiftRightJam128M( aPtr, count, zPtr ) softfloat_shiftRightJamM( 4, aPtr, count, zPtr )
857 #endif
858 
859 #ifndef softfloat_shiftRightJam160M
860 /*----------------------------------------------------------------------------
861 | This function or macro is the same as `softfloat_shiftRightJamM' with
862 | `size_words' = 5 (N = 160).
863 *----------------------------------------------------------------------------*/
864 #define softfloat_shiftRightJam160M( aPtr, count, zPtr ) softfloat_shiftRightJamM( 5, aPtr, count, zPtr )
865 #endif
866 
867 #ifndef softfloat_addM
868 /*----------------------------------------------------------------------------
869 | Adds the two N-bit integers pointed to by `aPtr' and `bPtr', where N =
870 | `size_words' * 32.  The addition is modulo 2^N, so any carry out is lost.
871 | The N-bit sum is stored at the location pointed to by `zPtr'.  Each of
872 | `aPtr', `bPtr', and `zPtr' points to a `size_words'-long array of 32-bit
873 | elements that concatenate in the platform's normal endian order to form an
874 | N-bit integer.
875 *----------------------------------------------------------------------------*/
876 void
877  softfloat_addM(
878      uint_fast8_t size_words,
879      const uint32_t *aPtr,
880      const uint32_t *bPtr,
881      uint32_t *zPtr
882  );
883 #endif
884 
885 #ifndef softfloat_add96M
886 /*----------------------------------------------------------------------------
887 | This function or macro is the same as `softfloat_addM' with `size_words'
888 | = 3 (N = 96).
889 *----------------------------------------------------------------------------*/
890 #define softfloat_add96M( aPtr, bPtr, zPtr ) softfloat_addM( 3, aPtr, bPtr, zPtr )
891 #endif
892 
893 #ifndef softfloat_add128M
894 /*----------------------------------------------------------------------------
895 | This function or macro is the same as `softfloat_addM' with `size_words'
896 | = 4 (N = 128).
897 *----------------------------------------------------------------------------*/
898 #define softfloat_add128M( aPtr, bPtr, zPtr ) softfloat_addM( 4, aPtr, bPtr, zPtr )
899 #endif
900 
901 #ifndef softfloat_add160M
902 /*----------------------------------------------------------------------------
903 | This function or macro is the same as `softfloat_addM' with `size_words'
904 | = 5 (N = 160).
905 *----------------------------------------------------------------------------*/
906 #define softfloat_add160M( aPtr, bPtr, zPtr ) softfloat_addM( 5, aPtr, bPtr, zPtr )
907 #endif
908 
909 #ifndef softfloat_addCarryM
910 /*----------------------------------------------------------------------------
911 | Adds the two N-bit unsigned integers pointed to by `aPtr' and `bPtr', where
912 | N = `size_words' * 32, plus `carry', which must be either 0 or 1.  The N-bit
913 | sum (modulo 2^N) is stored at the location pointed to by `zPtr', and any
914 | carry out is returned as the result.  Each of `aPtr', `bPtr', and `zPtr'
915 | points to a `size_words'-long array of 32-bit elements that concatenate in
916 | the platform's normal endian order to form an N-bit integer.
917 *----------------------------------------------------------------------------*/
918 uint_fast8_t
919  softfloat_addCarryM(
920      uint_fast8_t size_words,
921      const uint32_t *aPtr,
922      const uint32_t *bPtr,
923      uint_fast8_t carry,
924      uint32_t *zPtr
925  );
926 #endif
927 
928 #ifndef softfloat_addComplCarryM
929 /*----------------------------------------------------------------------------
930 | This function or macro is the same as `softfloat_addCarryM', except that
931 | the value of the unsigned integer pointed to by `bPtr' is bit-wise completed
932 | before the addition.
933 *----------------------------------------------------------------------------*/
934 uint_fast8_t
935  softfloat_addComplCarryM(
936      uint_fast8_t size_words,
937      const uint32_t *aPtr,
938      const uint32_t *bPtr,
939      uint_fast8_t carry,
940      uint32_t *zPtr
941  );
942 #endif
943 
944 #ifndef softfloat_addComplCarry96M
945 /*----------------------------------------------------------------------------
946 | This function or macro is the same as `softfloat_addComplCarryM' with
947 | `size_words' = 3 (N = 96).
948 *----------------------------------------------------------------------------*/
949 #define softfloat_addComplCarry96M( aPtr, bPtr, carry, zPtr ) softfloat_addComplCarryM( 3, aPtr, bPtr, carry, zPtr )
950 #endif
951 
952 #ifndef softfloat_negXM
953 /*----------------------------------------------------------------------------
954 | Replaces the N-bit unsigned integer pointed to by `zPtr' by the
955 | 2s-complement of itself, where N = `size_words' * 32.  Argument `zPtr'
956 | points to a `size_words'-long array of 32-bit elements that concatenate in
957 | the platform's normal endian order to form an N-bit integer.
958 *----------------------------------------------------------------------------*/
959 void softfloat_negXM( uint_fast8_t size_words, uint32_t *zPtr );
960 #endif
961 
962 #ifndef softfloat_negX96M
963 /*----------------------------------------------------------------------------
964 | This function or macro is the same as `softfloat_negXM' with `size_words'
965 | = 3 (N = 96).
966 *----------------------------------------------------------------------------*/
967 #define softfloat_negX96M( zPtr ) softfloat_negXM( 3, zPtr )
968 #endif
969 
970 #ifndef softfloat_negX128M
971 /*----------------------------------------------------------------------------
972 | This function or macro is the same as `softfloat_negXM' with `size_words'
973 | = 4 (N = 128).
974 *----------------------------------------------------------------------------*/
975 #define softfloat_negX128M( zPtr ) softfloat_negXM( 4, zPtr )
976 #endif
977 
978 #ifndef softfloat_negX160M
979 /*----------------------------------------------------------------------------
980 | This function or macro is the same as `softfloat_negXM' with `size_words'
981 | = 5 (N = 160).
982 *----------------------------------------------------------------------------*/
983 #define softfloat_negX160M( zPtr ) softfloat_negXM( 5, zPtr )
984 #endif
985 
986 #ifndef softfloat_negX256M
987 /*----------------------------------------------------------------------------
988 | This function or macro is the same as `softfloat_negXM' with `size_words'
989 | = 8 (N = 256).
990 *----------------------------------------------------------------------------*/
991 #define softfloat_negX256M( zPtr ) softfloat_negXM( 8, zPtr )
992 #endif
993 
994 #ifndef softfloat_sub1XM
995 /*----------------------------------------------------------------------------
996 | Subtracts 1 from the N-bit integer pointed to by `zPtr', where N =
997 | `size_words' * 32.  The subtraction is modulo 2^N, so any borrow out (carry
998 | out) is lost.  Argument `zPtr' points to a `size_words'-long array of 32-bit
999 | elements that concatenate in the platform's normal endian order to form an
1000 | N-bit integer.
1001 *----------------------------------------------------------------------------*/
1002 void softfloat_sub1XM( uint_fast8_t size_words, uint32_t *zPtr );
1003 #endif
1004 
1005 #ifndef softfloat_sub1X96M
1006 /*----------------------------------------------------------------------------
1007 | This function or macro is the same as `softfloat_sub1XM' with `size_words'
1008 | = 3 (N = 96).
1009 *----------------------------------------------------------------------------*/
1010 #define softfloat_sub1X96M( zPtr ) softfloat_sub1XM( 3, zPtr )
1011 #endif
1012 
1013 #ifndef softfloat_sub1X160M
1014 /*----------------------------------------------------------------------------
1015 | This function or macro is the same as `softfloat_sub1XM' with `size_words'
1016 | = 5 (N = 160).
1017 *----------------------------------------------------------------------------*/
1018 #define softfloat_sub1X160M( zPtr ) softfloat_sub1XM( 5, zPtr )
1019 #endif
1020 
1021 #ifndef softfloat_subM
1022 /*----------------------------------------------------------------------------
1023 | Subtracts the two N-bit integers pointed to by `aPtr' and `bPtr', where N =
1024 | `size_words' * 32.  The subtraction is modulo 2^N, so any borrow out (carry
1025 | out) is lost.  The N-bit difference is stored at the location pointed to by
1026 | `zPtr'.  Each of `aPtr', `bPtr', and `zPtr' points to a `size_words'-long
1027 | array of 32-bit elements that concatenate in the platform's normal endian
1028 | order to form an N-bit integer.
1029 *----------------------------------------------------------------------------*/
1030 void
1031  softfloat_subM(
1032      uint_fast8_t size_words,
1033      const uint32_t *aPtr,
1034      const uint32_t *bPtr,
1035      uint32_t *zPtr
1036  );
1037 #endif
1038 
1039 #ifndef softfloat_sub96M
1040 /*----------------------------------------------------------------------------
1041 | This function or macro is the same as `softfloat_subM' with `size_words'
1042 | = 3 (N = 96).
1043 *----------------------------------------------------------------------------*/
1044 #define softfloat_sub96M( aPtr, bPtr, zPtr ) softfloat_subM( 3, aPtr, bPtr, zPtr )
1045 #endif
1046 
1047 #ifndef softfloat_sub128M
1048 /*----------------------------------------------------------------------------
1049 | This function or macro is the same as `softfloat_subM' with `size_words'
1050 | = 4 (N = 128).
1051 *----------------------------------------------------------------------------*/
1052 #define softfloat_sub128M( aPtr, bPtr, zPtr ) softfloat_subM( 4, aPtr, bPtr, zPtr )
1053 #endif
1054 
1055 #ifndef softfloat_sub160M
1056 /*----------------------------------------------------------------------------
1057 | This function or macro is the same as `softfloat_subM' with `size_words'
1058 | = 5 (N = 160).
1059 *----------------------------------------------------------------------------*/
1060 #define softfloat_sub160M( aPtr, bPtr, zPtr ) softfloat_subM( 5, aPtr, bPtr, zPtr )
1061 #endif
1062 
1063 #ifndef softfloat_mul64To128M
1064 /*----------------------------------------------------------------------------
1065 | Multiplies `a' and `b' and stores the 128-bit product at the location
1066 | pointed to by `zPtr'.  Argument `zPtr' points to an array of four 32-bit
1067 | elements that concatenate in the platform's normal endian order to form a
1068 | 128-bit integer.
1069 *----------------------------------------------------------------------------*/
1070 void softfloat_mul64To128M( uint64_t a, uint64_t b, uint32_t *zPtr );
1071 #endif
1072 
1073 #ifndef softfloat_mul128MTo256M
1074 /*----------------------------------------------------------------------------
1075 | Multiplies the two 128-bit unsigned integers pointed to by `aPtr' and
1076 | `bPtr', and stores the 256-bit product at the location pointed to by `zPtr'.
1077 | Each of `aPtr' and `bPtr' points to an array of four 32-bit elements that
1078 | concatenate in the platform's normal endian order to form a 128-bit integer.
1079 | Argument `zPtr' points to an array of eight 32-bit elements that concatenate
1080 | to form a 256-bit integer.
1081 *----------------------------------------------------------------------------*/
1082 void
1083  softfloat_mul128MTo256M(
1084      const uint32_t *aPtr, const uint32_t *bPtr, uint32_t *zPtr );
1085 #endif
1086 
1087 #ifndef softfloat_remStepMBy32
1088 /*----------------------------------------------------------------------------
1089 | Performs a "remainder reduction step" as follows:  Arguments `remPtr' and
1090 | `bPtr' both point to N-bit unsigned integers, where N = `size_words' * 32.
1091 | Defining R and B as the values of those integers, the expression (R<<`count')
1092 | - B * q is computed modulo 2^N, and the N-bit result is stored at the
1093 | location pointed to by `zPtr'.  Each of `remPtr', `bPtr', and `zPtr' points
1094 | to a `size_words'-long array of 32-bit elements that concatenate in the
1095 | platform's normal endian order to form an N-bit integer.
1096 *----------------------------------------------------------------------------*/
1097 void
1098  softfloat_remStepMBy32(
1099      uint_fast8_t size_words,
1100      const uint32_t *remPtr,
1101      uint_fast8_t count,
1102      const uint32_t *bPtr,
1103      uint32_t q,
1104      uint32_t *zPtr
1105  );
1106 #endif
1107 
1108 #ifndef softfloat_remStep96MBy32
1109 /*----------------------------------------------------------------------------
1110 | This function or macro is the same as `softfloat_remStepMBy32' with
1111 | `size_words' = 3 (N = 96).
1112 *----------------------------------------------------------------------------*/
1113 #define softfloat_remStep96MBy32( remPtr, count, bPtr, q, zPtr ) softfloat_remStepMBy32( 3, remPtr, count, bPtr, q, zPtr )
1114 #endif
1115 
1116 #ifndef softfloat_remStep128MBy32
1117 /*----------------------------------------------------------------------------
1118 | This function or macro is the same as `softfloat_remStepMBy32' with
1119 | `size_words' = 4 (N = 128).
1120 *----------------------------------------------------------------------------*/
1121 #define softfloat_remStep128MBy32( remPtr, count, bPtr, q, zPtr ) softfloat_remStepMBy32( 4, remPtr, count, bPtr, q, zPtr )
1122 #endif
1123 
1124 #ifndef softfloat_remStep160MBy32
1125 /*----------------------------------------------------------------------------
1126 | This function or macro is the same as `softfloat_remStepMBy32' with
1127 | `size_words' = 5 (N = 160).
1128 *----------------------------------------------------------------------------*/
1129 #define softfloat_remStep160MBy32( remPtr, count, bPtr, q, zPtr ) softfloat_remStepMBy32( 5, remPtr, count, bPtr, q, zPtr )
1130 #endif
1131 
1132 #endif
1133 
1134 #endif
1135 
1136