|
Line 0
Link Here
|
|
|
1 |
--- src/libtomcrypt/src/headers/tomcrypt_macros.h.orig 2012-08-06 07:23:37.000000000 +0200 |
| 2 |
+++ src/libtomcrypt/src/headers/tomcrypt_macros.h 2015-03-02 21:40:07.785177000 +0100 |
| 3 |
@@ -262,21 +262,19 @@ |
| 4 |
|
| 5 |
#ifndef LTC_NO_ROLC |
| 6 |
|
| 7 |
-static inline __attribute__((always_inline)) unsigned ROLc(unsigned word, const int i) |
| 8 |
-{ |
| 9 |
- asm ("roll %2,%0" |
| 10 |
- :"=r" (word) |
| 11 |
- :"0" (word),"I" (i)); |
| 12 |
- return word; |
| 13 |
-} |
| 14 |
- |
| 15 |
-static inline __attribute__((always_inline)) unsigned RORc(unsigned word, const int i) |
| 16 |
-{ |
| 17 |
- asm ("rorl %2,%0" |
| 18 |
- :"=r" (word) |
| 19 |
- :"0" (word),"I" (i)); |
| 20 |
- return word; |
| 21 |
-} |
| 22 |
+#define ROLc(word, i) ({ \ |
| 23 |
+ unsigned _word = word; \ |
| 24 |
+ asm ("roll %2,%0" \ |
| 25 |
+ :"=r" (_word) \ |
| 26 |
+ :"0" (_word),"I" (i)); \ |
| 27 |
+ _word; }) |
| 28 |
+ |
| 29 |
+#define RORc(word, i) ({ \ |
| 30 |
+ unsigned _word = word; \ |
| 31 |
+ asm ("rorl %2,%0" \ |
| 32 |
+ :"=r" (_word) \ |
| 33 |
+ :"0" (_word),"I" (i)); \ |
| 34 |
+ _word; }) |
| 35 |
|
| 36 |
#else |
| 37 |
|
| 38 |
@@ -305,21 +303,19 @@ |
| 39 |
|
| 40 |
#ifndef LTC_NO_ROLC |
| 41 |
|
| 42 |
-static inline __attribute__((always_inline)) unsigned ROLc(unsigned word, const int i) |
| 43 |
-{ |
| 44 |
- asm ("rotlwi %0,%0,%2" |
| 45 |
- :"=r" (word) |
| 46 |
- :"0" (word),"I" (i)); |
| 47 |
- return word; |
| 48 |
-} |
| 49 |
- |
| 50 |
-static inline __attribute__((always_inline)) unsigned RORc(unsigned word, const int i) |
| 51 |
-{ |
| 52 |
- asm ("rotrwi %0,%0,%2" |
| 53 |
- :"=r" (word) |
| 54 |
- :"0" (word),"I" (i)); |
| 55 |
- return word; |
| 56 |
-} |
| 57 |
+#define ROLc(word, i) ({ \ |
| 58 |
+ unsigned _word = word; \ |
| 59 |
+ asm ("rotlwi %0,%0,%2" \ |
| 60 |
+ :"=r" (_word) \ |
| 61 |
+ :"0" (_word),"I" (i)); \ |
| 62 |
+ _word; }) |
| 63 |
+ |
| 64 |
+#define RORc(word, i) ({ \ |
| 65 |
+ unsigned _word = word; \ |
| 66 |
+ asm ("rotrwi %0,%0,%2" \ |
| 67 |
+ :"=r" (_word) \ |
| 68 |
+ :"0" (_word),"I" (i)); \ |
| 69 |
+ _word; }) |
| 70 |
|
| 71 |
#else |
| 72 |
|
| 73 |
@@ -361,21 +357,19 @@ |
| 74 |
|
| 75 |
#ifndef LTC_NO_ROLC |
| 76 |
|
| 77 |
-static inline __attribute__((always_inline)) unsigned long ROL64c(unsigned long word, const int i) |
| 78 |
-{ |
| 79 |
- asm("rolq %2,%0" |
| 80 |
- :"=r" (word) |
| 81 |
- :"0" (word),"J" (i)); |
| 82 |
- return word; |
| 83 |
-} |
| 84 |
- |
| 85 |
-static inline __attribute__((always_inline)) unsigned long ROR64c(unsigned long word, const int i) |
| 86 |
-{ |
| 87 |
- asm("rorq %2,%0" |
| 88 |
- :"=r" (word) |
| 89 |
- :"0" (word),"J" (i)); |
| 90 |
- return word; |
| 91 |
-} |
| 92 |
+#define ROL64c(word, i) ({ \ |
| 93 |
+ unsigned long _word = word; \ |
| 94 |
+ asm ("rolq %2,%0" \ |
| 95 |
+ :"=r" (_word) \ |
| 96 |
+ :"0" (_word),"J" (i)); \ |
| 97 |
+ _word; }) |
| 98 |
+ |
| 99 |
+#define ROR64c(word, i) ({ \ |
| 100 |
+ unsigned long _word = word; \ |
| 101 |
+ asm ("rorq %2,%0" \ |
| 102 |
+ :"=r" (_word) \ |
| 103 |
+ :"0" (_word),"J" (i)); \ |
| 104 |
+ _word; }) |
| 105 |
|
| 106 |
#else /* LTC_NO_ROLC */ |
| 107 |
|