Commit 94056660 authored by Guillaume Melquiond's avatar Guillaume Melquiond

Clean C drivers a bit.

parent 892f05d5
...@@ -289,8 +289,8 @@ module mach.int.UInt64GMP ...@@ -289,8 +289,8 @@ module mach.int.UInt64GMP
\n return result;\ \n return result;\
\n}\ \n}\
\n\ \n\
\nstruct __lsld64_result\ \nstruct __lsld64_result {\
\n{ uint64_t __field_0;\ \n uint64_t __field_0;\
\n uint64_t __field_1;\ \n uint64_t __field_1;\
\n};\ \n};\
\n\ \n\
......
...@@ -33,43 +33,28 @@ end ...@@ -33,43 +33,28 @@ end
blacklist "binverttab" blacklist "binverttab"
module mach.int.UInt64GMP module mach.int.UInt64GMP
interface interface "\
"\ntypedef unsigned __int128 uint128_t;\ \ntypedef unsigned __int128 uint128_t;\
\n\ \n\
\nstruct __mul64_double_result\ \nstruct __mul64_double_result {\
\n{ uint64_t __field_0;\ \n uint64_t __field_0;\
\n uint64_t __field_1;\ \n uint64_t __field_1;\
\n};\ \n};\
\n\ \n\
\nstatic inline struct __mul64_double_result mul64_double(uint64_t x, uint64_t y)\ \nstatic inline struct __mul64_double_result\
\n{\ \nmul64_double(uint64_t x, uint64_t y)\
\n uint128_t z = (uint128_t)x * (uint128_t)y;\ \n{\
\n struct __mul64_double_result result = { z, z >> 64 };\ \n uint128_t z = (uint128_t)x * (uint128_t)y;\
\n return result;\ \n struct __mul64_double_result result = { z, z >> 64 };\
\n}\ \n return result;\
\n\ \n}\
\nstatic inline uint64_t div64_2by1(uint64_t ul, uint64_t uh, uint64_t d)\ \n\
\n{\ \nstatic inline uint64_t\
\n return (((uint128_t)uh << 64) | ul) / d;\ \ndiv64_2by1(uint64_t ul, uint64_t uh, uint64_t d)\
\n}\ \n{\
" \n return (((uint128_t)uh << 64) | ul) / d;\
\n}\
(* " "
static struct __mul64_double_result mul64_double(uint64_t x, uint64_t y)
{
struct __mul64_double_result result;
umul_ppmm(result.__field_1,result.__field_0,x,y);
return result;
}
static uint64_t div64_2by1(uint64_t ul, uint64_t uh, uint64_t d)
{
uint64_t q;
uint64_t _dummy __attribute__((unused));
udiv_qrnnd(q,_dummy,uh,ul,d);
return q;
}
" *)
syntax val mul_double "mul64_double" syntax val mul_double "mul64_double"
syntax val div2by1 "div64_2by1" syntax val div2by1 "div64_2by1"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment