Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix implicit declaration of __builtin_bswap32 #77

Open
ghost opened this issue Dec 30, 2015 · 1 comment
Open

Fix implicit declaration of __builtin_bswap32 #77

ghost opened this issue Dec 30, 2015 · 1 comment

Comments

@ghost
Copy link

ghost commented Dec 30, 2015

A friend without Gihub account gave me this:

diff —git a/mtproto-utils.c b/mtproto-utils.c
index 60572b3..ce6926e 100644
-— a/mtproto-utils.c
+++ b/mtproto-utils.c
@@ -3,6 +3,15 @@
 #include "tgl.h"
 #include "tools.h"

+#if !defined(HAVE___BUILTIN_BSWAP32) && !defined(__FreeBSD__) && !defined(__OpenBSD__)
+static inline unsigned __builtin_bswap32(unsigned x) {
+  return ((x « 24) & 0xff000000 ) |
+  ((x « 8) & 0x00ff0000 ) |
+  ((x » 8) & 0x0000ff00 ) |
+  ((x » 24) & 0x000000ff );
+}
+#endif
+
 static unsigned long long gcd (unsigned long long a, unsigned long long b) {
   return b ? gcd (b, a % b) : a;
 }
@BenWiederhake
Copy link
Contributor

What problem does this solve? Is your friend aware that this seems to be a patch against the highly-outdated master branch? Could you tell your friend that the current test branch doesn't use that builtin anymore?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant