aboutsummaryrefslogtreecommitdiff
path: root/softfloat/s_countLeadingZeros32.c
diff options
context:
space:
mode:
authorAndrew Waterman <waterman@s144.Millennium.Berkeley.EDU>2010-10-15 16:17:53 -0700
committerAndrew Waterman <waterman@s144.Millennium.Berkeley.EDU>2010-10-15 16:17:53 -0700
commitab928baadbfd3316988a3ad5b5d9b84693a8636f (patch)
treeb464ce729d53aeff072ed2c341b06194e9ea174b /softfloat/s_countLeadingZeros32.c
parentd3cb781e165427412b299b6034289b8458472790 (diff)
downloadriscv-isa-sim-ab928baadbfd3316988a3ad5b5d9b84693a8636f.zip
riscv-isa-sim-ab928baadbfd3316988a3ad5b5d9b84693a8636f.tar.gz
riscv-isa-sim-ab928baadbfd3316988a3ad5b5d9b84693a8636f.tar.bz2
[sim] made softfloat files C instead of C++
Diffstat (limited to 'softfloat/s_countLeadingZeros32.c')
-rwxr-xr-xsoftfloat/s_countLeadingZeros32.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/softfloat/s_countLeadingZeros32.c b/softfloat/s_countLeadingZeros32.c
new file mode 100755
index 0000000..0bd17e1
--- /dev/null
+++ b/softfloat/s_countLeadingZeros32.c
@@ -0,0 +1,22 @@
+
+#include <stdint.h>
+#include "primitives.h"
+
+int softfloat_countLeadingZeros32( uint32_t a )
+{
+ int count;
+
+ count = 0;
+ if ( a < 0x10000 ) {
+ count = 16;
+ a <<= 16;
+ }
+ if ( a < 0x1000000 ) {
+ count += 8;
+ a <<= 8;
+ }
+ count += softfloat_countLeadingZeros8[ a>>24 ];
+ return count;
+
+}
+