File tree Expand file tree Collapse file tree 5 files changed +32
-1
lines changed
pk/asn1/der/object_identifier Expand file tree Collapse file tree 5 files changed +32
-1
lines changed Original file line number Diff line number Diff line change 17
17
*/
18
18
int ocb_ntz (unsigned long x )
19
19
{
20
+ #if defined(LTC_HAVE_CTZL_BUILTIN )
21
+ if (x == 0 )
22
+ return sizeof (unsigned long ) * CHAR_BIT ;
23
+ return __builtin_ctzl (x );
24
+ #else
20
25
int c ;
21
26
x &= 0xFFFFFFFFUL ;
22
27
c = 0 ;
@@ -25,6 +30,7 @@ int ocb_ntz(unsigned long x)
25
30
x >>= 1 ;
26
31
}
27
32
return c ;
33
+ #endif
28
34
}
29
35
30
36
#endif
Original file line number Diff line number Diff line change 16
16
*/
17
17
int ocb3_int_ntz (unsigned long x )
18
18
{
19
+ #if defined(LTC_HAVE_CTZL_BUILTIN )
20
+ if (x == 0 )
21
+ return sizeof (unsigned long ) * CHAR_BIT ;
22
+ return __builtin_ctzl (x );
23
+ #else
19
24
int c ;
20
25
x &= 0xFFFFFFFFUL ;
21
26
c = 0 ;
@@ -24,6 +29,7 @@ int ocb3_int_ntz(unsigned long x)
24
29
x >>= 1 ;
25
30
}
26
31
return c ;
32
+ #endif
27
33
}
28
34
29
35
#endif
Original file line number Diff line number Diff line change @@ -295,6 +295,14 @@ typedef unsigned long ltc_mp_digit;
295
295
#define LTC_HAVE_ROTATE_BUILTIN
296
296
#endif
297
297
298
+ #if __has_builtin (__builtin_clzl )
299
+ #define LTC_HAVE_CLZL_BUILTIN
300
+ #endif
301
+
302
+ #if __has_builtin (__builtin_ctzl )
303
+ #define LTC_HAVE_CTZL_BUILTIN
304
+ #endif
305
+
298
306
#if defined(__GNUC__ )
299
307
#define LTC_ALIGN (n ) __attribute__((aligned(n)))
300
308
#else
Original file line number Diff line number Diff line change 14
14
*/
15
15
int pmac_ntz (unsigned long x )
16
16
{
17
+ #if defined(LTC_HAVE_CTZL_BUILTIN )
18
+ if (x == 0 )
19
+ return sizeof (unsigned long ) * CHAR_BIT ;
20
+ return __builtin_ctzl (x );
21
+ #else
17
22
int c ;
18
23
x &= 0xFFFFFFFFUL ;
19
24
c = 0 ;
@@ -22,6 +27,7 @@ int pmac_ntz(unsigned long x)
22
27
x >>= 1 ;
23
28
}
24
29
return c ;
30
+ #endif
25
31
}
26
32
27
33
#endif
Original file line number Diff line number Diff line change 11
11
12
12
unsigned long der_object_identifier_bits (unsigned long x )
13
13
{
14
+ #if defined(LTC_HAVE_CLZL_BUILTIN )
15
+ if (x == 0 )
16
+ return 0 ;
17
+ return sizeof (unsigned long ) * CHAR_BIT - __builtin_clzl (x );
18
+ #else
14
19
unsigned long c ;
15
20
x &= (unsigned long )-1 ;
16
21
c = 0 ;
@@ -19,9 +24,9 @@ unsigned long der_object_identifier_bits(unsigned long x)
19
24
x >>= 1 ;
20
25
}
21
26
return c ;
27
+ #endif
22
28
}
23
29
24
-
25
30
/**
26
31
Gets length of DER encoding of Object Identifier
27
32
@param nwords The number of OID words
You can’t perform that action at this time.
0 commit comments