diff --git a/libc3/f128.c b/libc3/f128.c
index 6c9dd7b..f5e7377 100644
--- a/libc3/f128.c
+++ b/libc3/f128.c
@@ -91,10 +91,10 @@ f128 * f128_init_copy (f128 *x, const f128 *src)
f128 * f128_random (f128 *x)
{
- const f128 max = ((f128) 1 << 113) - 1;
+ const f128 max = exp2l(113) - 1;
f128 y;
arc4random_buf(y, 15);
- y = y & 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFF800000;
+ y = (f128) ((u128) y & 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFF800000);
*x = y;
return x;
}
diff --git a/libc3/types.h b/libc3/types.h
index 0a40f9c..4bec3df 100644
--- a/libc3/types.h
+++ b/libc3/types.h
@@ -39,16 +39,18 @@
#endif
/* Basic integer types. */
-typedef int8_t s8;
-typedef int16_t s16;
-typedef int32_t s32;
-typedef int64_t s64;
-typedef long sw;
-typedef uint8_t u8;
-typedef uint16_t u16;
-typedef uint32_t u32;
-typedef uint64_t u64;
-typedef unsigned long uw;
+typedef int8_t s8;
+typedef int16_t s16;
+typedef int32_t s32;
+typedef int64_t s64;
+typedef long long s128;
+typedef long sw;
+typedef uint8_t u8;
+typedef uint16_t u16;
+typedef uint32_t u32;
+typedef uint64_t u64;
+typedef unsigned long long u128;
+typedef unsigned long uw;
#ifdef SW_MAX
#undef SW_MAX