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