blob: 0bd36a1d69642e9cc49339d69b9f07b6afaef602 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
// See LICENSE.SoftFloat for license details.
#include <stdint.h>
#include "platform.h"
#include "primitives.h"
struct uint128
softfloat_shift128RightJam( uint64_t a64, uint64_t a0, unsigned int count )
{
unsigned int negCount;
struct uint128 z;
if ( count < 64 ) {
negCount = - count;
z.v64 = a64>>( count & 63 );
z.v0 =
a64<<( negCount & 63 ) | a0>>count
| ( (uint64_t) ( a0<<( negCount & 63 ) ) != 0 );
} else {
z.v64 = 0;
z.v0 =
( count < 128 )
? a64>>( count & 63 )
| ( ( ( a64 & ( ( (uint64_t) 1<<( count & 63 ) ) - 1 ) )
| a0 )
!= 0 )
: ( ( a64 | a0 ) != 0 );
}
return z;
}
|