blob: a96cd94ae58fe9a54b6200ae1344dc8bbbd7cb98 (
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
|
#include <stdint.h>
#include "platform.h"
#include "primitives.h"
struct uint256
softfloat_mul128To256( uint64_t a64, uint64_t a0, uint64_t b64, uint64_t b0 )
{
struct uint128 p0, p64, p128;
struct uint256 z;
p0 = softfloat_mul64To128( a0, b0 );
z.v0 = p0.v0;
p64 = softfloat_mul64To128( a64, b0 );
z.v64 = p64.v0 + p0.v64;
z.v128 = p64.v64 + ( z.v64 < p64.v0 );
p128 = softfloat_mul64To128( a64, b64 );
z.v128 += p128.v0;
z.v192 = p128.v64 + ( z.v128 < p128.v0 );
p64 = softfloat_mul64To128( a0, b64 );
z.v64 += p64.v0;
p64.v64 += ( z.v64 < p64.v0 );
z.v128 += p64.v64;
z.v192 += ( z.v128 < p64.v64 );
return z;
}
|