summaryrefslogtreecommitdiffstats
path: root/floatprops.h
diff options
context:
space:
mode:
authorErik Schnetter <schnetter@gmail.com>2013-09-01 23:45:23 -0400
committerErik Schnetter <schnetter@gmail.com>2013-09-01 23:45:23 -0400
commitae370822f291af84098b7d56721fa25b38b70a8b (patch)
tree82af54c76c8eef886938cef9d5e84ee1831905f7 /floatprops.h
parent0d32864cbff42a693f9b5c415642746797f5e9ff (diff)
downloadvecmathlib-ae370822f291af84098b7d56721fa25b38b70a8b.zip
vecmathlib-ae370822f291af84098b7d56721fa25b38b70a8b.tar.gz
Implement more integer functions: abs bitifthen clz isignbit max min popcount rotate
Rename integer signbit to isignbit to avoid name conflicts.
Diffstat (limited to 'floatprops.h')
-rw-r--r--floatprops.h24
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); }
OpenPOWER on IntegriCloud