diff options
Diffstat (limited to 'floatprops.h')
-rw-r--r-- | floatprops.h | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/floatprops.h b/floatprops.h index 45d4fed..e81d8d0 100644 --- a/floatprops.h +++ b/floatprops.h @@ -84,6 +84,12 @@ namespace vecmathlib { std::memcpy(&res, &x, sizeof res); return res; } + static int_t replicate_byte(unsigned char byte) + { + int_t res; + std::memset(&res, byte, sizeof res); + return res; + } // Convert values (truncate) static real_t convert_float(int_t x) { __builtin_unreachable(); } @@ -144,6 +150,12 @@ namespace vecmathlib { std::memcpy(&res, &x, sizeof res); return res; } + static int_t replicate_byte(unsigned char byte) + { + int_t res; + std::memset(&res, byte, sizeof res); + return res; + } // Convert values (truncate) static real_t convert_float(int_t x) { __builtin_unreachable(); } @@ -199,6 +211,12 @@ namespace vecmathlib { std::memcpy(&res, &x, sizeof res); return res; } + static int_t replicate_byte(unsigned char byte) + { + int_t res; + std::memset(&res, byte, sizeof res); + return res; + } // Convert values (truncate) static real_t convert_float(int_t x) { return real_t(x); } @@ -254,6 +272,12 @@ namespace vecmathlib { std::memcpy(&res, &x, sizeof res); return res; } + static int_t replicate_byte(unsigned char byte) + { + int_t res; + std::memset(&res, byte, sizeof res); + return res; + } // Convert values (truncate) static real_t convert_float(int_t x) { return real_t(x); } |