summaryrefslogtreecommitdiff
path: root/libl4/l4
diff options
context:
space:
mode:
authorneal <neal>2007-10-26 08:44:04 +0000
committerneal <neal>2007-10-26 08:44:04 +0000
commite6fd7b068116ee5d4477bd1bd28b81c1bc973335 (patch)
tree3ab8c800f143fc21993a6a895399bd509c07b671 /libl4/l4
parent0281ec92a5fbc2be3c1b871388275a72751e61ff (diff)
2007-10-26 Neal H. Walfield <neal@gnu.org>
* l4/math.h (_L4_msb64): New function. (_L4_lsb64): Likewise. * l4/gnu/math.h (l4_msb64): Likewise. (l4_lsb64): Likewise.
Diffstat (limited to 'libl4/l4')
-rw-r--r--libl4/l4/gnu/math.h16
-rw-r--r--libl4/l4/math.h31
2 files changed, 45 insertions, 2 deletions
diff --git a/libl4/l4/gnu/math.h b/libl4/l4/gnu/math.h
index e91c6dc..42b4a84 100644
--- a/libl4/l4/gnu/math.h
+++ b/libl4/l4/gnu/math.h
@@ -1,5 +1,5 @@
/* l4/gnu/math.h - Public GNU interface for L4 mathematical functions.
- Copyright (C) 2004 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2007 Free Software Foundation, Inc.
Written by Marcus Brinkmann <marcus@gnu.org>.
This file is part of the GNU L4 library.
@@ -31,6 +31,13 @@ l4_msb (l4_word_t data)
return _L4_msb (data);
}
+static inline l4_word_t
+_L4_attribute_always_inline
+l4_msb64 (l4_uint64_t data)
+{
+ return _L4_msb64 (data);
+}
+
static inline l4_word_t
_L4_attribute_always_inline
@@ -38,3 +45,10 @@ l4_lsb (l4_word_t data)
{
return _L4_lsb (data);
}
+
+static inline l4_word_t
+_L4_attribute_always_inline
+l4_lsb64 (l4_uint64_t data)
+{
+ return _L4_lsb64 (data);
+}
diff --git a/libl4/l4/math.h b/libl4/l4/math.h
index 7ae6ae5..f5a2a3c 100644
--- a/libl4/l4/math.h
+++ b/libl4/l4/math.h
@@ -1,5 +1,5 @@
/* l4/math.h - Public interface to L4 mathematical support functions.
- Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2004, 2007 Free Software Foundation, Inc.
Written by Marcus Brinkmann <marcus@gnu.org>.
This file is part of the GNU L4 library.
@@ -72,6 +72,19 @@ _L4_msb (_L4_word_t data)
return 0;
}
+static inline _L4_word_t
+_L4_attribute_always_inline
+_L4_msb64 (_L4_uint64_t data)
+{
+#if L4_WORDSIZE == 64
+ return _L4_msb (data);
+#else
+ int d = _L4_msb (data >> 32);
+ if (d)
+ return d + 32;
+ return _L4_msb (data);
+#endif
+}
/* Return 0 if DATA is 0, or the bit number of the least significant
bit set in DATA. The least significant bit is 1, the most
@@ -113,6 +126,22 @@ _L4_lsb (_L4_word_t data)
return 0;
}
+static inline _L4_word_t
+_L4_attribute_always_inline
+_L4_lsb64 (_L4_uint64_t data)
+{
+#if L4_WORDSIZE == 64
+ return _L4_lsb (data);
+#else
+ int d = _L4_lsb (data);
+ if (d)
+ return d;
+ d = _L4_lsb (data >> 32);
+ if (d)
+ return d + 32;
+ return 0;
+#endif
+}
/* Now incorporate the public interfaces the user has selected. */
#ifdef _L4_INTERFACE_GNU