[Xenomai-git] Philippe Gerum : boilerplate: provide count-leading/trailing-bits ops

2016-06-28 Thread git repository hosting
Module: xenomai-3
Branch: wip/dovetail
Commit: fe5b21b7faa0309fb46325989343c8722ade8107
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=fe5b21b7faa0309fb46325989343c8722ade8107

Author: Philippe Gerum 
Date:   Tue Jun  7 10:10:17 2016 +0200

boilerplate: provide count-leading/trailing-bits ops

---

 include/boilerplate/compiler.h |   48 
 1 file changed, 48 insertions(+)

diff --git a/include/boilerplate/compiler.h b/include/boilerplate/compiler.h
index e558f73..0509e33 100644
--- a/include/boilerplate/compiler.h
+++ b/include/boilerplate/compiler.h
@@ -58,4 +58,52 @@
 #define __deprecated   __attribute__((__deprecated__))
 #endif
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+   
+void __invalid_operand_size(void);
+
+#define ctz(__v)   \
+   ({  \
+   int __ret;  \
+   if (!__v)   \
+   __ret = sizeof(__v) * 8;\
+   else\
+   switch (sizeof(__v)) {  \
+   case sizeof(int):   \
+   __ret = __builtin_ctz((unsigned int)__v); \
+   break;  \
+   case sizeof(long long): \
+   __ret = __builtin_ctzll(__v);   \
+   break;  \
+   default:\
+   __invalid_operand_size();   \
+   }   \
+   __ret;  \
+   })
+
+#define clz(__v)   \
+   ({  \
+   int __ret;  \
+   if (!__v)   \
+   __ret = sizeof(__v) * 8;\
+   else\
+   switch (sizeof(__v)) {  \
+   case sizeof(int):   \
+   __ret = __builtin_clz((unsigned int)__v); \
+   break;  \
+   case sizeof(long long): \
+   __ret = __builtin_clzll(__v);   \
+   break;  \
+   default:\
+   __invalid_operand_size();   \
+   }   \
+   __ret;  \
+   })
+   
+#ifdef __cplusplus
+}
+#endif
+   
 #endif /* _BOILERPLATE_COMPILER_H */


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : boilerplate: provide count-leading/trailing-bits ops

2016-06-08 Thread git repository hosting
Module: xenomai-3
Branch: wip/gpio
Commit: 5defc2afa24f72d8fc138582a1f4e51c21eeb2a5
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=5defc2afa24f72d8fc138582a1f4e51c21eeb2a5

Author: Philippe Gerum 
Date:   Tue Jun  7 10:10:17 2016 +0200

boilerplate: provide count-leading/trailing-bits ops

---

 include/boilerplate/compiler.h |   48 
 1 file changed, 48 insertions(+)

diff --git a/include/boilerplate/compiler.h b/include/boilerplate/compiler.h
index e558f73..0509e33 100644
--- a/include/boilerplate/compiler.h
+++ b/include/boilerplate/compiler.h
@@ -58,4 +58,52 @@
 #define __deprecated   __attribute__((__deprecated__))
 #endif
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+   
+void __invalid_operand_size(void);
+
+#define ctz(__v)   \
+   ({  \
+   int __ret;  \
+   if (!__v)   \
+   __ret = sizeof(__v) * 8;\
+   else\
+   switch (sizeof(__v)) {  \
+   case sizeof(int):   \
+   __ret = __builtin_ctz((unsigned int)__v); \
+   break;  \
+   case sizeof(long long): \
+   __ret = __builtin_ctzll(__v);   \
+   break;  \
+   default:\
+   __invalid_operand_size();   \
+   }   \
+   __ret;  \
+   })
+
+#define clz(__v)   \
+   ({  \
+   int __ret;  \
+   if (!__v)   \
+   __ret = sizeof(__v) * 8;\
+   else\
+   switch (sizeof(__v)) {  \
+   case sizeof(int):   \
+   __ret = __builtin_clz((unsigned int)__v); \
+   break;  \
+   case sizeof(long long): \
+   __ret = __builtin_clzll(__v);   \
+   break;  \
+   default:\
+   __invalid_operand_size();   \
+   }   \
+   __ret;  \
+   })
+   
+#ifdef __cplusplus
+}
+#endif
+   
 #endif /* _BOILERPLATE_COMPILER_H */


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : boilerplate: provide count-leading/trailing-bits ops

2016-06-08 Thread git repository hosting
Module: xenomai-3
Branch: stable-3.0.x
Commit: 5defc2afa24f72d8fc138582a1f4e51c21eeb2a5
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=5defc2afa24f72d8fc138582a1f4e51c21eeb2a5

Author: Philippe Gerum 
Date:   Tue Jun  7 10:10:17 2016 +0200

boilerplate: provide count-leading/trailing-bits ops

---

 include/boilerplate/compiler.h |   48 
 1 file changed, 48 insertions(+)

diff --git a/include/boilerplate/compiler.h b/include/boilerplate/compiler.h
index e558f73..0509e33 100644
--- a/include/boilerplate/compiler.h
+++ b/include/boilerplate/compiler.h
@@ -58,4 +58,52 @@
 #define __deprecated   __attribute__((__deprecated__))
 #endif
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+   
+void __invalid_operand_size(void);
+
+#define ctz(__v)   \
+   ({  \
+   int __ret;  \
+   if (!__v)   \
+   __ret = sizeof(__v) * 8;\
+   else\
+   switch (sizeof(__v)) {  \
+   case sizeof(int):   \
+   __ret = __builtin_ctz((unsigned int)__v); \
+   break;  \
+   case sizeof(long long): \
+   __ret = __builtin_ctzll(__v);   \
+   break;  \
+   default:\
+   __invalid_operand_size();   \
+   }   \
+   __ret;  \
+   })
+
+#define clz(__v)   \
+   ({  \
+   int __ret;  \
+   if (!__v)   \
+   __ret = sizeof(__v) * 8;\
+   else\
+   switch (sizeof(__v)) {  \
+   case sizeof(int):   \
+   __ret = __builtin_clz((unsigned int)__v); \
+   break;  \
+   case sizeof(long long): \
+   __ret = __builtin_clzll(__v);   \
+   break;  \
+   default:\
+   __invalid_operand_size();   \
+   }   \
+   __ret;  \
+   })
+   
+#ifdef __cplusplus
+}
+#endif
+   
 #endif /* _BOILERPLATE_COMPILER_H */


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : boilerplate: provide count-leading/trailing-bits ops

2016-06-08 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: fe5b21b7faa0309fb46325989343c8722ade8107
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=fe5b21b7faa0309fb46325989343c8722ade8107

Author: Philippe Gerum 
Date:   Tue Jun  7 10:10:17 2016 +0200

boilerplate: provide count-leading/trailing-bits ops

---

 include/boilerplate/compiler.h |   48 
 1 file changed, 48 insertions(+)

diff --git a/include/boilerplate/compiler.h b/include/boilerplate/compiler.h
index e558f73..0509e33 100644
--- a/include/boilerplate/compiler.h
+++ b/include/boilerplate/compiler.h
@@ -58,4 +58,52 @@
 #define __deprecated   __attribute__((__deprecated__))
 #endif
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+   
+void __invalid_operand_size(void);
+
+#define ctz(__v)   \
+   ({  \
+   int __ret;  \
+   if (!__v)   \
+   __ret = sizeof(__v) * 8;\
+   else\
+   switch (sizeof(__v)) {  \
+   case sizeof(int):   \
+   __ret = __builtin_ctz((unsigned int)__v); \
+   break;  \
+   case sizeof(long long): \
+   __ret = __builtin_ctzll(__v);   \
+   break;  \
+   default:\
+   __invalid_operand_size();   \
+   }   \
+   __ret;  \
+   })
+
+#define clz(__v)   \
+   ({  \
+   int __ret;  \
+   if (!__v)   \
+   __ret = sizeof(__v) * 8;\
+   else\
+   switch (sizeof(__v)) {  \
+   case sizeof(int):   \
+   __ret = __builtin_clz((unsigned int)__v); \
+   break;  \
+   case sizeof(long long): \
+   __ret = __builtin_clzll(__v);   \
+   break;  \
+   default:\
+   __invalid_operand_size();   \
+   }   \
+   __ret;  \
+   })
+   
+#ifdef __cplusplus
+}
+#endif
+   
 #endif /* _BOILERPLATE_COMPILER_H */


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : boilerplate: provide count-leading/trailing-bits ops

2016-06-07 Thread git repository hosting
Module: xenomai-3
Branch: wip/heap-bitmap
Commit: fd914396b6474a107c3e174c7d0c7e0b40ab75ea
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=fd914396b6474a107c3e174c7d0c7e0b40ab75ea

Author: Philippe Gerum 
Date:   Tue Jun  7 10:10:17 2016 +0200

boilerplate: provide count-leading/trailing-bits ops

---

 include/boilerplate/compiler.h |   48 
 1 file changed, 48 insertions(+)

diff --git a/include/boilerplate/compiler.h b/include/boilerplate/compiler.h
index e558f73..0509e33 100644
--- a/include/boilerplate/compiler.h
+++ b/include/boilerplate/compiler.h
@@ -58,4 +58,52 @@
 #define __deprecated   __attribute__((__deprecated__))
 #endif
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+   
+void __invalid_operand_size(void);
+
+#define ctz(__v)   \
+   ({  \
+   int __ret;  \
+   if (!__v)   \
+   __ret = sizeof(__v) * 8;\
+   else\
+   switch (sizeof(__v)) {  \
+   case sizeof(int):   \
+   __ret = __builtin_ctz((unsigned int)__v); \
+   break;  \
+   case sizeof(long long): \
+   __ret = __builtin_ctzll(__v);   \
+   break;  \
+   default:\
+   __invalid_operand_size();   \
+   }   \
+   __ret;  \
+   })
+
+#define clz(__v)   \
+   ({  \
+   int __ret;  \
+   if (!__v)   \
+   __ret = sizeof(__v) * 8;\
+   else\
+   switch (sizeof(__v)) {  \
+   case sizeof(int):   \
+   __ret = __builtin_clz((unsigned int)__v); \
+   break;  \
+   case sizeof(long long): \
+   __ret = __builtin_clzll(__v);   \
+   break;  \
+   default:\
+   __invalid_operand_size();   \
+   }   \
+   __ret;  \
+   })
+   
+#ifdef __cplusplus
+}
+#endif
+   
 #endif /* _BOILERPLATE_COMPILER_H */


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git