Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
s_mul64To128.c File Reference
#include <stdint.h>
#include "platform.h"
#include "primitiveTypes.h"
Include dependency graph for s_mul64To128.c:

Go to the source code of this file.

Functions

struct uint128 softfloat_mul64To128 (uint64_t a, uint64_t b)
 

Function Documentation

◆ softfloat_mul64To128()

struct uint128 softfloat_mul64To128 ( uint64_t a,
uint64_t b )

Definition at line 43 of file s_mul64To128.c.

44{
45 uint32_t a32, a0, b32, b0;
46 struct uint128 z;
47 uint64_t mid1, mid;
48
49 a32 = a>>32;
50 a0 = a;
51 b32 = b>>32;
52 b0 = b;
53 z.v0 = (uint_fast64_t) a0 * b0;
54 mid1 = (uint_fast64_t) a32 * b0;
55 mid = mid1 + (uint_fast64_t) a0 * b32;
56 z.v64 = (uint_fast64_t) a32 * b32;
57 z.v64 += (uint_fast64_t) (mid < mid1)<<32 | mid>>32;
58 mid <<= 32;
59 z.v0 += mid;
60 z.v64 += (z.v0 < mid);
61 return z;
62
63}
const GenericPointer< typename T::ValueType > T2 T::AllocatorType & a
Definition pointer.h:1181
unsigned int uint32_t
Definition stdint.h:126
uint64_t uint_fast64_t
Definition stdint.h:157
unsigned __int64 uint64_t
Definition stdint.h:136