File Coverage

djbsort_src/crypto_int32.h
Criterion Covered Total %
statement 3 3 100.0
branch n/a
condition n/a
subroutine n/a
pod n/a
total 3 3 100.0


line stmt bran cond sub pod time code
1             /* auto-generated: cd cryptoint; ./autogen */
2             /* cryptoint 20250414 (plus __FILC__ tweak) */
3              
4             #ifndef crypto_int32_h
5             #define crypto_int32_h
6              
7             #include
8             #define crypto_int32 int32_t
9             #define crypto_int32_unsigned uint32_t
10              
11             #define crypto_int32_optblocker djbsort_int32_optblocker
12             extern volatile crypto_int32 crypto_int32_optblocker;
13              
14             __attribute__((unused))
15             static inline
16             crypto_int32 crypto_int32_load(const unsigned char *crypto_int32_s) {
17             crypto_int32 crypto_int32_z = 0;
18             crypto_int32_z |= ((crypto_int32) (*crypto_int32_s++)) << 0;
19             crypto_int32_z |= ((crypto_int32) (*crypto_int32_s++)) << 8;
20             crypto_int32_z |= ((crypto_int32) (*crypto_int32_s++)) << 16;
21             crypto_int32_z |= ((crypto_int32) (*crypto_int32_s++)) << 24;
22             return crypto_int32_z;
23             }
24              
25             __attribute__((unused))
26             static inline
27             crypto_int32 crypto_int32_load_bigendian(const unsigned char *crypto_int32_s) {
28             crypto_int32 crypto_int32_z = 0;
29             crypto_int32_z |= ((crypto_int32) (*crypto_int32_s++)) << 24;
30             crypto_int32_z |= ((crypto_int32) (*crypto_int32_s++)) << 16;
31             crypto_int32_z |= ((crypto_int32) (*crypto_int32_s++)) << 8;
32             crypto_int32_z |= ((crypto_int32) (*crypto_int32_s++)) << 0;
33             return crypto_int32_z;
34             }
35              
36             __attribute__((unused))
37             static inline
38             void crypto_int32_store(unsigned char *crypto_int32_s,crypto_int32 crypto_int32_x) {
39             *crypto_int32_s++ = crypto_int32_x >> 0;
40             *crypto_int32_s++ = crypto_int32_x >> 8;
41             *crypto_int32_s++ = crypto_int32_x >> 16;
42             *crypto_int32_s++ = crypto_int32_x >> 24;
43             }
44              
45             __attribute__((unused))
46             static inline
47             void crypto_int32_store_bigendian(unsigned char *crypto_int32_s,crypto_int32 crypto_int32_x) {
48             *crypto_int32_s++ = crypto_int32_x >> 24;
49             *crypto_int32_s++ = crypto_int32_x >> 16;
50             *crypto_int32_s++ = crypto_int32_x >> 8;
51             *crypto_int32_s++ = crypto_int32_x >> 0;
52             }
53              
54             __attribute__((unused))
55             static inline
56 6           crypto_int32 crypto_int32_negative_mask(crypto_int32 crypto_int32_x) {
57             #if (defined(__GNUASM__) || (defined(__GNUC__) && !defined(__FILC__))) && defined(__x86_64__)
58 6           __asm__ ("sarl $31,%0" : "+r"(crypto_int32_x) : : "cc");
59 6           return crypto_int32_x;
60             #elif (defined(__GNUASM__) || (defined(__GNUC__) && !defined(__FILC__))) && defined(__aarch64__)
61             crypto_int32 crypto_int32_y;
62             __asm__ ("asr %w0,%w1,31" : "=r"(crypto_int32_y) : "r"(crypto_int32_x) : );
63             return crypto_int32_y;
64             #elif (defined(__GNUASM__) || (defined(__GNUC__) && !defined(__FILC__))) && defined(__arm__) && defined(__ARM_ARCH) && (__ARM_ARCH >= 6) && !defined(__thumb__)
65             crypto_int32 crypto_int32_y;
66             __asm__ ("asr %0,%1,#31" : "=r"(crypto_int32_y) : "r"(crypto_int32_x) : );
67             return crypto_int32_y;
68             #elif (defined(__GNUASM__) || (defined(__GNUC__) && !defined(__FILC__))) && defined(__sparc_v8__)
69             crypto_int32 crypto_int32_y;
70             __asm__ ("sra %1,31,%0" : "=r"(crypto_int32_y) : "r"(crypto_int32_x) : );
71             return crypto_int32_y;
72             #else
73             crypto_int32_x >>= 32-6;
74             crypto_int32_x += crypto_int32_optblocker;
75             crypto_int32_x >>= 5;
76             return crypto_int32_x;
77             #endif
78             }
79              
80             __attribute__((unused))
81             static inline
82             crypto_int32_unsigned crypto_int32_unsigned_topbit_01(crypto_int32_unsigned crypto_int32_x) {
83             #if (defined(__GNUASM__) || (defined(__GNUC__) && !defined(__FILC__))) && defined(__x86_64__)
84             __asm__ ("shrl $31,%0" : "+r"(crypto_int32_x) : : "cc");
85             return crypto_int32_x;
86             #elif (defined(__GNUASM__) || (defined(__GNUC__) && !defined(__FILC__))) && defined(__aarch64__)
87             crypto_int32_unsigned crypto_int32_y;
88             __asm__ ("lsr %w0,%w1,31" : "=r"(crypto_int32_y) : "r"(crypto_int32_x) : );
89             return crypto_int32_y;
90             #elif (defined(__GNUASM__) || (defined(__GNUC__) && !defined(__FILC__))) && defined(__arm__) && defined(__ARM_ARCH) && (__ARM_ARCH >= 6) && !defined(__thumb__)
91             crypto_int32 crypto_int32_y;
92             __asm__ ("lsr %0,%1,#31" : "=r"(crypto_int32_y) : "r"(crypto_int32_x) : );
93             return crypto_int32_y;
94             #elif (defined(__GNUASM__) || (defined(__GNUC__) && !defined(__FILC__))) && defined(__sparc_v8__)
95             crypto_int32_unsigned crypto_int32_y;
96             __asm__ ("srl %1,31,%0" : "=r"(crypto_int32_y) : "r"(crypto_int32_x) : );
97             return crypto_int32_y;
98             #else
99             crypto_int32_x >>= 32-6;
100             crypto_int32_x += crypto_int32_optblocker;
101             crypto_int32_x >>= 5;
102             return crypto_int32_x;
103             #endif
104             }
105              
106             __attribute__((unused))
107             static inline
108             crypto_int32 crypto_int32_negative_01(crypto_int32 crypto_int32_x) {
109             return crypto_int32_unsigned_topbit_01(crypto_int32_x);
110             }
111              
112             __attribute__((unused))
113             static inline
114             crypto_int32 crypto_int32_topbit_mask(crypto_int32 crypto_int32_x) {
115             return crypto_int32_negative_mask(crypto_int32_x);
116             }
117              
118             __attribute__((unused))
119             static inline
120             crypto_int32 crypto_int32_topbit_01(crypto_int32 crypto_int32_x) {
121             return crypto_int32_unsigned_topbit_01(crypto_int32_x);
122             }
123              
124             __attribute__((unused))
125             static inline
126             crypto_int32 crypto_int32_bottombit_mask(crypto_int32 crypto_int32_x) {
127             #if (defined(__GNUASM__) || (defined(__GNUC__) && !defined(__FILC__))) && defined(__x86_64__)
128             __asm__ ("andl $1,%0" : "+r"(crypto_int32_x) : : "cc");
129             return -crypto_int32_x;
130             #elif (defined(__GNUASM__) || (defined(__GNUC__) && !defined(__FILC__))) && defined(__aarch64__)
131             crypto_int32 crypto_int32_y;
132             __asm__ ("sbfx %w0,%w1,0,1" : "=r"(crypto_int32_y) : "r"(crypto_int32_x) : );
133             return crypto_int32_y;
134             #elif (defined(__GNUASM__) || (defined(__GNUC__) && !defined(__FILC__))) && defined(__arm__) && defined(__ARM_ARCH) && (__ARM_ARCH >= 6) && !defined(__thumb__)
135             crypto_int32 crypto_int32_y;
136             __asm__ ("and %0,%1,#1\n neg %0,%0" : "=r"(crypto_int32_y) : "r"(crypto_int32_x) : );
137             return crypto_int32_y;
138             #elif (defined(__GNUASM__) || (defined(__GNUC__) && !defined(__FILC__))) && defined(__sparc_v8__)
139             crypto_int32 crypto_int32_y;
140             __asm__ ("and %1,1,%0\n neg %0,%0" : "=r"(crypto_int32_y) : "r"(crypto_int32_x) : );
141             return crypto_int32_y;
142             #else
143             crypto_int32_x &= 1 + crypto_int32_optblocker;
144             return -crypto_int32_x;
145             #endif
146             }
147              
148             __attribute__((unused))
149             static inline
150             crypto_int32 crypto_int32_bottombit_01(crypto_int32 crypto_int32_x) {
151             #if (defined(__GNUASM__) || (defined(__GNUC__) && !defined(__FILC__))) && defined(__x86_64__)
152             __asm__ ("andl $1,%0" : "+r"(crypto_int32_x) : : "cc");
153             return crypto_int32_x;
154             #elif (defined(__GNUASM__) || (defined(__GNUC__) && !defined(__FILC__))) && defined(__aarch64__)
155             crypto_int32 crypto_int32_y;
156             __asm__ ("ubfx %w0,%w1,0,1" : "=r"(crypto_int32_y) : "r"(crypto_int32_x) : );
157             return crypto_int32_y;
158             #elif (defined(__GNUASM__) || (defined(__GNUC__) && !defined(__FILC__))) && defined(__arm__) && defined(__ARM_ARCH) && (__ARM_ARCH >= 6) && !defined(__thumb__)
159             crypto_int32 crypto_int32_y;
160             __asm__ ("and %0,%1,#1" : "=r"(crypto_int32_y) : "r"(crypto_int32_x) : );
161             return crypto_int32_y;
162             #elif (defined(__GNUASM__) || (defined(__GNUC__) && !defined(__FILC__))) && defined(__sparc_v8__)
163             crypto_int32 crypto_int32_y;
164             __asm__ ("and %1,1,%0" : "=r"(crypto_int32_y) : "r"(crypto_int32_x) : );
165             return crypto_int32_y;
166             #else
167             crypto_int32_x &= 1 + crypto_int32_optblocker;
168             return crypto_int32_x;
169             #endif
170             }
171              
172             __attribute__((unused))
173             static inline
174             crypto_int32 crypto_int32_bitinrangepublicpos_mask(crypto_int32 crypto_int32_x,crypto_int32 crypto_int32_s) {
175             #if (defined(__GNUASM__) || (defined(__GNUC__) && !defined(__FILC__))) && defined(__x86_64__)
176             __asm__ ("sarl %%cl,%0" : "+r"(crypto_int32_x) : "c"(crypto_int32_s) : "cc");
177             #elif (defined(__GNUASM__) || (defined(__GNUC__) && !defined(__FILC__))) && defined(__aarch64__)
178             __asm__ ("asr %w0,%w0,%w1" : "+r"(crypto_int32_x) : "r"(crypto_int32_s) : );
179             #elif (defined(__GNUASM__) || (defined(__GNUC__) && !defined(__FILC__))) && defined(__arm__) && defined(__ARM_ARCH) && (__ARM_ARCH >= 6) && !defined(__thumb__)
180             __asm__ ("and %0,%0,#31\n asr %1,%1,%0" : "+&r"(crypto_int32_s), "+r"(crypto_int32_x) : : );
181             #elif (defined(__GNUASM__) || (defined(__GNUC__) && !defined(__FILC__))) && defined(__sparc_v8__)
182             __asm__ ("sra %0,%1,%0" : "+r"(crypto_int32_x) : "r"(crypto_int32_s) : );
183             #else
184             crypto_int32_x >>= crypto_int32_s ^ crypto_int32_optblocker;
185             #endif
186             return crypto_int32_bottombit_mask(crypto_int32_x);
187             }
188              
189             __attribute__((unused))
190             static inline
191             crypto_int32 crypto_int32_bitinrangepublicpos_01(crypto_int32 crypto_int32_x,crypto_int32 crypto_int32_s) {
192             #if (defined(__GNUASM__) || (defined(__GNUC__) && !defined(__FILC__))) && defined(__x86_64__)
193             __asm__ ("sarl %%cl,%0" : "+r"(crypto_int32_x) : "c"(crypto_int32_s) : "cc");
194             #elif (defined(__GNUASM__) || (defined(__GNUC__) && !defined(__FILC__))) && defined(__aarch64__)
195             __asm__ ("asr %w0,%w0,%w1" : "+r"(crypto_int32_x) : "r"(crypto_int32_s) : );
196             #elif (defined(__GNUASM__) || (defined(__GNUC__) && !defined(__FILC__))) && defined(__arm__) && defined(__ARM_ARCH) && (__ARM_ARCH >= 6) && !defined(__thumb__)
197             __asm__ ("and %0,%0,#31\n asr %1,%1,%0" : "+&r"(crypto_int32_s), "+r"(crypto_int32_x) : : );
198             #elif (defined(__GNUASM__) || (defined(__GNUC__) && !defined(__FILC__))) && defined(__sparc_v8__)
199             __asm__ ("sra %0,%1,%0" : "+r"(crypto_int32_x) : "r"(crypto_int32_s) : );
200             #else
201             crypto_int32_x >>= crypto_int32_s ^ crypto_int32_optblocker;
202             #endif
203             return crypto_int32_bottombit_01(crypto_int32_x);
204             }
205              
206             __attribute__((unused))
207             static inline
208             crypto_int32 crypto_int32_shlmod(crypto_int32 crypto_int32_x,crypto_int32 crypto_int32_s) {
209             #if (defined(__GNUASM__) || (defined(__GNUC__) && !defined(__FILC__))) && defined(__x86_64__)
210             __asm__ ("shll %%cl,%0" : "+r"(crypto_int32_x) : "c"(crypto_int32_s) : "cc");
211             #elif (defined(__GNUASM__) || (defined(__GNUC__) && !defined(__FILC__))) && defined(__aarch64__)
212             __asm__ ("lsl %w0,%w0,%w1" : "+r"(crypto_int32_x) : "r"(crypto_int32_s) : );
213             #elif (defined(__GNUASM__) || (defined(__GNUC__) && !defined(__FILC__))) && defined(__arm__) && defined(__ARM_ARCH) && (__ARM_ARCH >= 6) && !defined(__thumb__)
214             crypto_int32_s &= 31;
215             __asm__ ("lsl %0,%0,%1" : "+r"(crypto_int32_x) : "r"(crypto_int32_s) : );
216             #elif (defined(__GNUASM__) || (defined(__GNUC__) && !defined(__FILC__))) && defined(__sparc_v8__)
217             __asm__ ("sll %0,%1,%0" : "+r"(crypto_int32_x) : "r"(crypto_int32_s) : );
218             #else
219             int crypto_int32_k, crypto_int32_l;
220             for (crypto_int32_l = 0,crypto_int32_k = 1;crypto_int32_k < 32;++crypto_int32_l,crypto_int32_k *= 2)
221             crypto_int32_x ^= (crypto_int32_x ^ (crypto_int32_x << crypto_int32_k)) & crypto_int32_bitinrangepublicpos_mask(crypto_int32_s,crypto_int32_l);
222             #endif
223             return crypto_int32_x;
224             }
225              
226             __attribute__((unused))
227             static inline
228             crypto_int32 crypto_int32_shrmod(crypto_int32 crypto_int32_x,crypto_int32 crypto_int32_s) {
229             #if (defined(__GNUASM__) || (defined(__GNUC__) && !defined(__FILC__))) && defined(__x86_64__)
230             __asm__ ("sarl %%cl,%0" : "+r"(crypto_int32_x) : "c"(crypto_int32_s) : "cc");
231             #elif (defined(__GNUASM__) || (defined(__GNUC__) && !defined(__FILC__))) && defined(__aarch64__)
232             __asm__ ("asr %w0,%w0,%w1" : "+r"(crypto_int32_x) : "r"(crypto_int32_s) : );
233             #elif (defined(__GNUASM__) || (defined(__GNUC__) && !defined(__FILC__))) && defined(__arm__) && defined(__ARM_ARCH) && (__ARM_ARCH >= 6) && !defined(__thumb__)
234             crypto_int32_s &= 31;
235             __asm__ ("asr %0,%0,%1" : "+r"(crypto_int32_x) : "r"(crypto_int32_s) : );
236             #elif (defined(__GNUASM__) || (defined(__GNUC__) && !defined(__FILC__))) && defined(__sparc_v8__)
237             __asm__ ("sra %0,%1,%0" : "+r"(crypto_int32_x) : "r"(crypto_int32_s) : );
238             #else
239             int crypto_int32_k, crypto_int32_l;
240             for (crypto_int32_l = 0,crypto_int32_k = 1;crypto_int32_k < 32;++crypto_int32_l,crypto_int32_k *= 2)
241             crypto_int32_x ^= (crypto_int32_x ^ (crypto_int32_x >> crypto_int32_k)) & crypto_int32_bitinrangepublicpos_mask(crypto_int32_s,crypto_int32_l);
242             #endif
243             return crypto_int32_x;
244             }
245              
246             __attribute__((unused))
247             static inline
248             crypto_int32 crypto_int32_bitmod_mask(crypto_int32 crypto_int32_x,crypto_int32 crypto_int32_s) {
249             crypto_int32_x = crypto_int32_shrmod(crypto_int32_x,crypto_int32_s);
250             return crypto_int32_bottombit_mask(crypto_int32_x);
251             }
252              
253             __attribute__((unused))
254             static inline
255             crypto_int32 crypto_int32_bitmod_01(crypto_int32 crypto_int32_x,crypto_int32 crypto_int32_s) {
256             crypto_int32_x = crypto_int32_shrmod(crypto_int32_x,crypto_int32_s);
257             return crypto_int32_bottombit_01(crypto_int32_x);
258             }
259              
260             __attribute__((unused))
261             static inline
262             crypto_int32 crypto_int32_nonzero_mask(crypto_int32 crypto_int32_x) {
263             #if (defined(__GNUASM__) || (defined(__GNUC__) && !defined(__FILC__))) && defined(__x86_64__)
264             crypto_int32 crypto_int32_q,crypto_int32_z;
265             __asm__ ("xorl %0,%0\n movl $-1,%1\n testl %2,%2\n cmovnel %1,%0" : "=&r"(crypto_int32_z), "=&r"(crypto_int32_q) : "r"(crypto_int32_x) : "cc");
266             return crypto_int32_z;
267             #elif (defined(__GNUASM__) || (defined(__GNUC__) && !defined(__FILC__))) && defined(__aarch64__)
268             crypto_int32 crypto_int32_z;
269             __asm__ ("cmp %w1,0\n csetm %w0,ne" : "=r"(crypto_int32_z) : "r"(crypto_int32_x) : "cc");
270             return crypto_int32_z;
271             #elif (defined(__GNUASM__) || (defined(__GNUC__) && !defined(__FILC__))) && defined(__arm__) && defined(__ARM_ARCH) && (__ARM_ARCH >= 6) && !defined(__thumb__)
272             __asm__ ("cmp %0,#0\n movne %0,#-1" : "+r"(crypto_int32_x) : : "cc");
273             return crypto_int32_x;
274             #elif (defined(__GNUASM__) || (defined(__GNUC__) && !defined(__FILC__))) && defined(__sparc_v8__)
275             crypto_int32 crypto_int32_z;
276             __asm__ ("cmp %%g0,%1\n subx %%g0,0,%0" : "=r"(crypto_int32_z) : "r"(crypto_int32_x) : "cc");
277             return crypto_int32_z;
278             #else
279             crypto_int32_x |= -crypto_int32_x;
280             return crypto_int32_negative_mask(crypto_int32_x);
281             #endif
282             }
283              
284             __attribute__((unused))
285             static inline
286             crypto_int32 crypto_int32_nonzero_01(crypto_int32 crypto_int32_x) {
287             #if (defined(__GNUASM__) || (defined(__GNUC__) && !defined(__FILC__))) && defined(__x86_64__)
288             crypto_int32 crypto_int32_q,crypto_int32_z;
289             __asm__ ("xorl %0,%0\n movl $1,%1\n testl %2,%2\n cmovnel %1,%0" : "=&r"(crypto_int32_z), "=&r"(crypto_int32_q) : "r"(crypto_int32_x) : "cc");
290             return crypto_int32_z;
291             #elif (defined(__GNUASM__) || (defined(__GNUC__) && !defined(__FILC__))) && defined(__aarch64__)
292             crypto_int32 crypto_int32_z;
293             __asm__ ("cmp %w1,0\n cset %w0,ne" : "=r"(crypto_int32_z) : "r"(crypto_int32_x) : "cc");
294             return crypto_int32_z;
295             #elif (defined(__GNUASM__) || (defined(__GNUC__) && !defined(__FILC__))) && defined(__arm__) && defined(__ARM_ARCH) && (__ARM_ARCH >= 6) && !defined(__thumb__)
296             __asm__ ("cmp %0,#0\n movne %0,#1" : "+r"(crypto_int32_x) : : "cc");
297             return crypto_int32_x;
298             #elif (defined(__GNUASM__) || (defined(__GNUC__) && !defined(__FILC__))) && defined(__sparc_v8__)
299             crypto_int32 crypto_int32_z;
300             __asm__ ("cmp %%g0,%1\n addx %%g0,0,%0" : "=r"(crypto_int32_z) : "r"(crypto_int32_x) : "cc");
301             return crypto_int32_z;
302             #else
303             crypto_int32_x |= -crypto_int32_x;
304             return crypto_int32_unsigned_topbit_01(crypto_int32_x);
305             #endif
306             }
307              
308             __attribute__((unused))
309             static inline
310             crypto_int32 crypto_int32_positive_mask(crypto_int32 crypto_int32_x) {
311             #if (defined(__GNUASM__) || (defined(__GNUC__) && !defined(__FILC__))) && defined(__x86_64__)
312             crypto_int32 crypto_int32_q,crypto_int32_z;
313             __asm__ ("xorl %0,%0\n movl $-1,%1\n testl %2,%2\n cmovgl %1,%0" : "=&r"(crypto_int32_z), "=&r"(crypto_int32_q) : "r"(crypto_int32_x) : "cc");
314             return crypto_int32_z;
315             #elif (defined(__GNUASM__) || (defined(__GNUC__) && !defined(__FILC__))) && defined(__aarch64__)
316             crypto_int32 crypto_int32_z;
317             __asm__ ("cmp %w1,0\n csetm %w0,gt" : "=r"(crypto_int32_z) : "r"(crypto_int32_x) : "cc");
318             return crypto_int32_z;
319             #elif (defined(__GNUASM__) || (defined(__GNUC__) && !defined(__FILC__))) && defined(__sparc_v8__)
320             crypto_int32 crypto_int32_z;
321             __asm__ ("sra %1,31,%0\n sub %0,%1,%0\n sra %0,31,%0" : "=&r"(crypto_int32_z) : "r"(crypto_int32_x) : );
322             return crypto_int32_z;
323             #else
324             crypto_int32 crypto_int32_z = -crypto_int32_x;
325             crypto_int32_z ^= crypto_int32_x & crypto_int32_z;
326             return crypto_int32_negative_mask(crypto_int32_z);
327             #endif
328             }
329              
330             __attribute__((unused))
331             static inline
332             crypto_int32 crypto_int32_positive_01(crypto_int32 crypto_int32_x) {
333             #if (defined(__GNUASM__) || (defined(__GNUC__) && !defined(__FILC__))) && defined(__x86_64__)
334             crypto_int32 crypto_int32_q,crypto_int32_z;
335             __asm__ ("xorl %0,%0\n movl $1,%1\n testl %2,%2\n cmovgl %1,%0" : "=&r"(crypto_int32_z), "=&r"(crypto_int32_q) : "r"(crypto_int32_x) : "cc");
336             return crypto_int32_z;
337             #elif (defined(__GNUASM__) || (defined(__GNUC__) && !defined(__FILC__))) && defined(__aarch64__)
338             crypto_int32 crypto_int32_z;
339             __asm__ ("cmp %w1,0\n cset %w0,gt" : "=r"(crypto_int32_z) : "r"(crypto_int32_x) : "cc");
340             return crypto_int32_z;
341             #elif (defined(__GNUASM__) || (defined(__GNUC__) && !defined(__FILC__))) && defined(__sparc_v8__)
342             crypto_int32 crypto_int32_z;
343             __asm__ ("sra %1,31,%0\n sub %0,%1,%0\n srl %0,31,%0" : "=&r"(crypto_int32_z) : "r"(crypto_int32_x) : );
344             return crypto_int32_z;
345             #else
346             crypto_int32 crypto_int32_z = -crypto_int32_x;
347             crypto_int32_z ^= crypto_int32_x & crypto_int32_z;
348             return crypto_int32_unsigned_topbit_01(crypto_int32_z);
349             #endif
350             }
351              
352             __attribute__((unused))
353             static inline
354             crypto_int32 crypto_int32_zero_mask(crypto_int32 crypto_int32_x) {
355             #if (defined(__GNUASM__) || (defined(__GNUC__) && !defined(__FILC__))) && defined(__x86_64__)
356             crypto_int32 crypto_int32_q,crypto_int32_z;
357             __asm__ ("xorl %0,%0\n movl $-1,%1\n testl %2,%2\n cmovel %1,%0" : "=&r"(crypto_int32_z), "=&r"(crypto_int32_q) : "r"(crypto_int32_x) : "cc");
358             return crypto_int32_z;
359             #elif (defined(__GNUASM__) || (defined(__GNUC__) && !defined(__FILC__))) && defined(__aarch64__)
360             crypto_int32 crypto_int32_z;
361             __asm__ ("cmp %w1,0\n csetm %w0,eq" : "=r"(crypto_int32_z) : "r"(crypto_int32_x) : "cc");
362             return crypto_int32_z;
363             #elif (defined(__GNUASM__) || (defined(__GNUC__) && !defined(__FILC__))) && defined(__sparc_v8__)
364             crypto_int32 crypto_int32_z;
365             __asm__ ("cmp %%g0,%1\n addx %%g0,-1,%0" : "=r"(crypto_int32_z) : "r"(crypto_int32_x) : "cc");
366             return crypto_int32_z;
367             #else
368             return ~crypto_int32_nonzero_mask(crypto_int32_x);
369             #endif
370             }
371              
372             __attribute__((unused))
373             static inline
374             crypto_int32 crypto_int32_zero_01(crypto_int32 crypto_int32_x) {
375             #if (defined(__GNUASM__) || (defined(__GNUC__) && !defined(__FILC__))) && defined(__x86_64__)
376             crypto_int32 crypto_int32_q,crypto_int32_z;
377             __asm__ ("xorl %0,%0\n movl $1,%1\n testl %2,%2\n cmovel %1,%0" : "=&r"(crypto_int32_z), "=&r"(crypto_int32_q) : "r"(crypto_int32_x) : "cc");
378             return crypto_int32_z;
379             #elif (defined(__GNUASM__) || (defined(__GNUC__) && !defined(__FILC__))) && defined(__aarch64__)
380             crypto_int32 crypto_int32_z;
381             __asm__ ("cmp %w1,0\n cset %w0,eq" : "=r"(crypto_int32_z) : "r"(crypto_int32_x) : "cc");
382             return crypto_int32_z;
383             #elif (defined(__GNUASM__) || (defined(__GNUC__) && !defined(__FILC__))) && defined(__sparc_v8__)
384             crypto_int32 crypto_int32_z;
385             __asm__ ("cmp %%g0,%1\n subx %%g0,-1,%0" : "=r"(crypto_int32_z) : "r"(crypto_int32_x) : "cc");
386             return crypto_int32_z;
387             #else
388             return 1-crypto_int32_nonzero_01(crypto_int32_x);
389             #endif
390             }
391              
392             __attribute__((unused))
393             static inline
394             crypto_int32 crypto_int32_unequal_mask(crypto_int32 crypto_int32_x,crypto_int32 crypto_int32_y) {
395             #if (defined(__GNUASM__) || (defined(__GNUC__) && !defined(__FILC__))) && defined(__x86_64__)
396             crypto_int32 crypto_int32_q,crypto_int32_z;
397             __asm__ ("xorl %0,%0\n movl $-1,%1\n cmpl %3,%2\n cmovnel %1,%0" : "=&r"(crypto_int32_z), "=&r"(crypto_int32_q) : "r"(crypto_int32_x), "r"(crypto_int32_y) : "cc");
398             return crypto_int32_z;
399             #elif (defined(__GNUASM__) || (defined(__GNUC__) && !defined(__FILC__))) && defined(__aarch64__)
400             crypto_int32 crypto_int32_z;
401             __asm__ ("cmp %w1,%w2\n csetm %w0,ne" : "=r"(crypto_int32_z) : "r"(crypto_int32_x), "r"(crypto_int32_y) : "cc");
402             return crypto_int32_z;
403             #else
404             return crypto_int32_nonzero_mask(crypto_int32_x ^ crypto_int32_y);
405             #endif
406             }
407              
408             __attribute__((unused))
409             static inline
410             crypto_int32 crypto_int32_unequal_01(crypto_int32 crypto_int32_x,crypto_int32 crypto_int32_y) {
411             #if (defined(__GNUASM__) || (defined(__GNUC__) && !defined(__FILC__))) && defined(__x86_64__)
412             crypto_int32 crypto_int32_q,crypto_int32_z;
413             __asm__ ("xorl %0,%0\n movl $1,%1\n cmpl %3,%2\n cmovnel %1,%0" : "=&r"(crypto_int32_z), "=&r"(crypto_int32_q) : "r"(crypto_int32_x), "r"(crypto_int32_y) : "cc");
414             return crypto_int32_z;
415             #elif (defined(__GNUASM__) || (defined(__GNUC__) && !defined(__FILC__))) && defined(__aarch64__)
416             crypto_int32 crypto_int32_z;
417             __asm__ ("cmp %w1,%w2\n cset %w0,ne" : "=r"(crypto_int32_z) : "r"(crypto_int32_x), "r"(crypto_int32_y) : "cc");
418             return crypto_int32_z;
419             #else
420             return crypto_int32_nonzero_01(crypto_int32_x ^ crypto_int32_y);
421             #endif
422             }
423              
424             __attribute__((unused))
425             static inline
426             crypto_int32 crypto_int32_equal_mask(crypto_int32 crypto_int32_x,crypto_int32 crypto_int32_y) {
427             #if (defined(__GNUASM__) || (defined(__GNUC__) && !defined(__FILC__))) && defined(__x86_64__)
428             crypto_int32 crypto_int32_q,crypto_int32_z;
429             __asm__ ("xorl %0,%0\n movl $-1,%1\n cmpl %3,%2\n cmovel %1,%0" : "=&r"(crypto_int32_z), "=&r"(crypto_int32_q) : "r"(crypto_int32_x), "r"(crypto_int32_y) : "cc");
430             return crypto_int32_z;
431             #elif (defined(__GNUASM__) || (defined(__GNUC__) && !defined(__FILC__))) && defined(__aarch64__)
432             crypto_int32 crypto_int32_z;
433             __asm__ ("cmp %w1,%w2\n csetm %w0,eq" : "=r"(crypto_int32_z) : "r"(crypto_int32_x), "r"(crypto_int32_y) : "cc");
434             return crypto_int32_z;
435             #else
436             return crypto_int32_zero_mask(crypto_int32_x ^ crypto_int32_y);
437             #endif
438             }
439              
440             __attribute__((unused))
441             static inline
442             crypto_int32 crypto_int32_equal_01(crypto_int32 crypto_int32_x,crypto_int32 crypto_int32_y) {
443             #if (defined(__GNUASM__) || (defined(__GNUC__) && !defined(__FILC__))) && defined(__x86_64__)
444             crypto_int32 crypto_int32_q,crypto_int32_z;
445             __asm__ ("xorl %0,%0\n movl $1,%1\n cmpl %3,%2\n cmovel %1,%0" : "=&r"(crypto_int32_z), "=&r"(crypto_int32_q) : "r"(crypto_int32_x), "r"(crypto_int32_y) : "cc");
446             return crypto_int32_z;
447             #elif (defined(__GNUASM__) || (defined(__GNUC__) && !defined(__FILC__))) && defined(__aarch64__)
448             crypto_int32 crypto_int32_z;
449             __asm__ ("cmp %w1,%w2\n cset %w0,eq" : "=r"(crypto_int32_z) : "r"(crypto_int32_x), "r"(crypto_int32_y) : "cc");
450             return crypto_int32_z;
451             #else
452             return crypto_int32_zero_01(crypto_int32_x ^ crypto_int32_y);
453             #endif
454             }
455              
456             __attribute__((unused))
457             static inline
458             crypto_int32 crypto_int32_min(crypto_int32 crypto_int32_x,crypto_int32 crypto_int32_y) {
459             #if (defined(__GNUASM__) || (defined(__GNUC__) && !defined(__FILC__))) && defined(__x86_64__)
460             __asm__ ("cmpl %1,%0\n cmovgl %1,%0" : "+r"(crypto_int32_x) : "r"(crypto_int32_y) : "cc");
461             return crypto_int32_x;
462             #elif (defined(__GNUASM__) || (defined(__GNUC__) && !defined(__FILC__))) && defined(__aarch64__)
463             __asm__ ("cmp %w0,%w1\n csel %w0,%w0,%w1,lt" : "+r"(crypto_int32_x) : "r"(crypto_int32_y) : "cc");
464             return crypto_int32_x;
465             #else
466             crypto_int32 crypto_int32_r = crypto_int32_y ^ crypto_int32_x;
467             crypto_int32 crypto_int32_z = crypto_int32_y - crypto_int32_x;
468             crypto_int32_z ^= crypto_int32_r & (crypto_int32_z ^ crypto_int32_y);
469             crypto_int32_z = crypto_int32_negative_mask(crypto_int32_z);
470             crypto_int32_z &= crypto_int32_r;
471             return crypto_int32_x ^ crypto_int32_z;
472             #endif
473             }
474              
475             __attribute__((unused))
476             static inline
477             crypto_int32 crypto_int32_max(crypto_int32 crypto_int32_x,crypto_int32 crypto_int32_y) {
478             #if (defined(__GNUASM__) || (defined(__GNUC__) && !defined(__FILC__))) && defined(__x86_64__)
479             __asm__ ("cmpl %1,%0\n cmovll %1,%0" : "+r"(crypto_int32_x) : "r"(crypto_int32_y) : "cc");
480             return crypto_int32_x;
481             #elif (defined(__GNUASM__) || (defined(__GNUC__) && !defined(__FILC__))) && defined(__aarch64__)
482             __asm__ ("cmp %w0,%w1\n csel %w0,%w1,%w0,lt" : "+r"(crypto_int32_x) : "r"(crypto_int32_y) : "cc");
483             return crypto_int32_x;
484             #else
485             crypto_int32 crypto_int32_r = crypto_int32_y ^ crypto_int32_x;
486             crypto_int32 crypto_int32_z = crypto_int32_y - crypto_int32_x;
487             crypto_int32_z ^= crypto_int32_r & (crypto_int32_z ^ crypto_int32_y);
488             crypto_int32_z = crypto_int32_negative_mask(crypto_int32_z);
489             crypto_int32_z &= crypto_int32_r;
490             return crypto_int32_y ^ crypto_int32_z;
491             #endif
492             }
493              
494             __attribute__((unused))
495             static inline
496             void crypto_int32_minmax(crypto_int32 *crypto_int32_p,crypto_int32 *crypto_int32_q) {
497             crypto_int32 crypto_int32_x = *crypto_int32_p;
498             crypto_int32 crypto_int32_y = *crypto_int32_q;
499             #if (defined(__GNUASM__) || (defined(__GNUC__) && !defined(__FILC__))) && defined(__x86_64__)
500             crypto_int32 crypto_int32_z;
501             __asm__ ("cmpl %2,%1\n movl %1,%0\n cmovgl %2,%1\n cmovgl %0,%2" : "=&r"(crypto_int32_z), "+&r"(crypto_int32_x), "+r"(crypto_int32_y) : : "cc");
502             *crypto_int32_p = crypto_int32_x;
503             *crypto_int32_q = crypto_int32_y;
504             #elif (defined(__GNUASM__) || (defined(__GNUC__) && !defined(__FILC__))) && defined(__aarch64__)
505             crypto_int32 crypto_int32_r, crypto_int32_s;
506             __asm__ ("cmp %w2,%w3\n csel %w0,%w2,%w3,lt\n csel %w1,%w3,%w2,lt" : "=&r"(crypto_int32_r), "=r"(crypto_int32_s) : "r"(crypto_int32_x), "r"(crypto_int32_y) : "cc");
507             *crypto_int32_p = crypto_int32_r;
508             *crypto_int32_q = crypto_int32_s;
509             #else
510             crypto_int32 crypto_int32_r = crypto_int32_y ^ crypto_int32_x;
511             crypto_int32 crypto_int32_z = crypto_int32_y - crypto_int32_x;
512             crypto_int32_z ^= crypto_int32_r & (crypto_int32_z ^ crypto_int32_y);
513             crypto_int32_z = crypto_int32_negative_mask(crypto_int32_z);
514             crypto_int32_z &= crypto_int32_r;
515             crypto_int32_x ^= crypto_int32_z;
516             crypto_int32_y ^= crypto_int32_z;
517             *crypto_int32_p = crypto_int32_x;
518             *crypto_int32_q = crypto_int32_y;
519             #endif
520             }
521              
522             __attribute__((unused))
523             static inline
524             crypto_int32 crypto_int32_smaller_mask(crypto_int32 crypto_int32_x,crypto_int32 crypto_int32_y) {
525             #if (defined(__GNUASM__) || (defined(__GNUC__) && !defined(__FILC__))) && defined(__x86_64__)
526             crypto_int32 crypto_int32_q,crypto_int32_z;
527             __asm__ ("xorl %0,%0\n movl $-1,%1\n cmpl %3,%2\n cmovll %1,%0" : "=&r"(crypto_int32_z), "=&r"(crypto_int32_q) : "r"(crypto_int32_x), "r"(crypto_int32_y) : "cc");
528             return crypto_int32_z;
529             #elif (defined(__GNUASM__) || (defined(__GNUC__) && !defined(__FILC__))) && defined(__aarch64__)
530             crypto_int32 crypto_int32_z;
531             __asm__ ("cmp %w1,%w2\n csetm %w0,lt" : "=r"(crypto_int32_z) : "r"(crypto_int32_x), "r"(crypto_int32_y) : "cc");
532             return crypto_int32_z;
533             #else
534             crypto_int32 crypto_int32_r = crypto_int32_x ^ crypto_int32_y;
535             crypto_int32 crypto_int32_z = crypto_int32_x - crypto_int32_y;
536             crypto_int32_z ^= crypto_int32_r & (crypto_int32_z ^ crypto_int32_x);
537             return crypto_int32_negative_mask(crypto_int32_z);
538             #endif
539             }
540              
541             __attribute__((unused))
542             static inline
543             crypto_int32 crypto_int32_smaller_01(crypto_int32 crypto_int32_x,crypto_int32 crypto_int32_y) {
544             #if (defined(__GNUASM__) || (defined(__GNUC__) && !defined(__FILC__))) && defined(__x86_64__)
545             crypto_int32 crypto_int32_q,crypto_int32_z;
546             __asm__ ("xorl %0,%0\n movl $1,%1\n cmpl %3,%2\n cmovll %1,%0" : "=&r"(crypto_int32_z), "=&r"(crypto_int32_q) : "r"(crypto_int32_x), "r"(crypto_int32_y) : "cc");
547             return crypto_int32_z;
548             #elif (defined(__GNUASM__) || (defined(__GNUC__) && !defined(__FILC__))) && defined(__aarch64__)
549             crypto_int32 crypto_int32_z;
550             __asm__ ("cmp %w1,%w2\n cset %w0,lt" : "=r"(crypto_int32_z) : "r"(crypto_int32_x), "r"(crypto_int32_y) : "cc");
551             return crypto_int32_z;
552             #else
553             crypto_int32 crypto_int32_r = crypto_int32_x ^ crypto_int32_y;
554             crypto_int32 crypto_int32_z = crypto_int32_x - crypto_int32_y;
555             crypto_int32_z ^= crypto_int32_r & (crypto_int32_z ^ crypto_int32_x);
556             return crypto_int32_unsigned_topbit_01(crypto_int32_z);
557             #endif
558             }
559              
560             __attribute__((unused))
561             static inline
562             crypto_int32 crypto_int32_leq_mask(crypto_int32 crypto_int32_x,crypto_int32 crypto_int32_y) {
563             #if (defined(__GNUASM__) || (defined(__GNUC__) && !defined(__FILC__))) && defined(__x86_64__)
564             crypto_int32 crypto_int32_q,crypto_int32_z;
565             __asm__ ("xorl %0,%0\n movl $-1,%1\n cmpl %3,%2\n cmovlel %1,%0" : "=&r"(crypto_int32_z), "=&r"(crypto_int32_q) : "r"(crypto_int32_x), "r"(crypto_int32_y) : "cc");
566             return crypto_int32_z;
567             #elif (defined(__GNUASM__) || (defined(__GNUC__) && !defined(__FILC__))) && defined(__aarch64__)
568             crypto_int32 crypto_int32_z;
569             __asm__ ("cmp %w1,%w2\n csetm %w0,le" : "=r"(crypto_int32_z) : "r"(crypto_int32_x), "r"(crypto_int32_y) : "cc");
570             return crypto_int32_z;
571             #else
572             return ~crypto_int32_smaller_mask(crypto_int32_y,crypto_int32_x);
573             #endif
574             }
575              
576             __attribute__((unused))
577             static inline
578             crypto_int32 crypto_int32_leq_01(crypto_int32 crypto_int32_x,crypto_int32 crypto_int32_y) {
579             #if (defined(__GNUASM__) || (defined(__GNUC__) && !defined(__FILC__))) && defined(__x86_64__)
580             crypto_int32 crypto_int32_q,crypto_int32_z;
581             __asm__ ("xorl %0,%0\n movl $1,%1\n cmpl %3,%2\n cmovlel %1,%0" : "=&r"(crypto_int32_z), "=&r"(crypto_int32_q) : "r"(crypto_int32_x), "r"(crypto_int32_y) : "cc");
582             return crypto_int32_z;
583             #elif (defined(__GNUASM__) || (defined(__GNUC__) && !defined(__FILC__))) && defined(__aarch64__)
584             crypto_int32 crypto_int32_z;
585             __asm__ ("cmp %w1,%w2\n cset %w0,le" : "=r"(crypto_int32_z) : "r"(crypto_int32_x), "r"(crypto_int32_y) : "cc");
586             return crypto_int32_z;
587             #else
588             return 1-crypto_int32_smaller_01(crypto_int32_y,crypto_int32_x);
589             #endif
590             }
591              
592             __attribute__((unused))
593             static inline
594             int crypto_int32_ones_num(crypto_int32 crypto_int32_x) {
595             crypto_int32_unsigned crypto_int32_y = crypto_int32_x;
596             const crypto_int32 C0 = 0x55555555;
597             const crypto_int32 C1 = 0x33333333;
598             const crypto_int32 C2 = 0x0f0f0f0f;
599             crypto_int32_y -= ((crypto_int32_y >> 1) & C0);
600             crypto_int32_y = (crypto_int32_y & C1) + ((crypto_int32_y >> 2) & C1);
601             crypto_int32_y = (crypto_int32_y + (crypto_int32_y >> 4)) & C2;
602             crypto_int32_y += crypto_int32_y >> 8;
603             crypto_int32_y = (crypto_int32_y + (crypto_int32_y >> 16)) & 0xff;
604             return crypto_int32_y;
605             }
606              
607             __attribute__((unused))
608             static inline
609             int crypto_int32_bottomzeros_num(crypto_int32 crypto_int32_x) {
610             #if (defined(__GNUASM__) || (defined(__GNUC__) && !defined(__FILC__))) && defined(__x86_64__)
611             crypto_int32 fallback = 32;
612             __asm__ ("bsfl %0,%0\n cmovel %1,%0" : "+&r"(crypto_int32_x) : "r"(fallback) : "cc");
613             return crypto_int32_x;
614             #elif (defined(__GNUASM__) || (defined(__GNUC__) && !defined(__FILC__))) && defined(__aarch64__)
615             int64_t crypto_int32_y;
616             __asm__ ("rbit %w0,%w1\n clz %w0,%w0" : "=r"(crypto_int32_y) : "r"(crypto_int32_x) : );
617             return crypto_int32_y;
618             #else
619             crypto_int32 crypto_int32_y = crypto_int32_x ^ (crypto_int32_x-1);
620             crypto_int32_y = ((crypto_int32) crypto_int32_y) >> 1;
621             crypto_int32_y &= ~(crypto_int32_x & (((crypto_int32) 1) << (32-1)));
622             return crypto_int32_ones_num(crypto_int32_y);
623             #endif
624             }
625              
626             #endif