[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Minios-devel] [UNIKRAFT/NEWLIB PATCH] include/endian.h Define the __bswap16, __bswap32, __bswap64 builtin functions only if the compilation is done with gcc



Hi Alice,

I have a question to this patch:

On 01.03.20 20:13, alicesuiu wrote:
Signed-off-by: Alice Suiu <alicesuiu17@xxxxxxxxx>
---
  include/endian.h | 2 ++
  1 file changed, 2 insertions(+)

diff --git a/include/endian.h b/include/endian.h
index 3c8a752..63d3650 100644
--- a/include/endian.h
+++ b/include/endian.h
@@ -41,6 +41,7 @@
#include <stdint.h> +#ifndef __clang__
  static inline uint16_t __bswap16(uint16_t __x)
  {
        return __x<<8 | __x>>8;
@@ -55,6 +56,7 @@ static inline uint64_t __bswap64(uint64_t __x)
  {
        return (__bswap32(__x)+0ULL)<<32 | __bswap32(__x>>32);
  }
+#endif

Doesn't GCC has a builtin for this and does clang has one, too? We also need to make sure that clang is not introducing libc replacements as default. On GCC that broke the printing with nolibc...

#if __BYTE_ORDER == __LITTLE_ENDIAN
  #define htobe16(x) __bswap16(x)


Thanks,

Simon

_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.