Telariust / pollard-kangaroo-c99

Pollard, kangaroo method, solving discrete logarithm problem (DLP) using pseudorandom walks, C99
21 stars 13 forks source link

compile issue #4

Closed hamnaz closed 4 years ago

hamnaz commented 4 years ago

check this area

if !ALLOC_ALIGN

//hashtb_entry *DPht = (hashtb_entry *) malloc( HASH_SIZE * sizeof(struct hashtb_entry) );
hashtb_entry *DPht = (hashtb_entry *) calloc( HASH_SIZE, sizeof(struct hashtb_entry) );
#else
hashtb_entry *DPht = (hashtb_entry *) aligned_alloc( 4, HASH_SIZE * sizeof(struct hashtb_entry) ); //C11
#endif

gcc-8 -std=c99 -O2 -I secp256k1/src/ -I secp256k1/ k022.c -lgmp -lm -o k022 k022.c: In function ‘main’: k022.c:740:40: warning: implicit declaration of function ‘aligned_alloc’; did you mean ‘checked_malloc’? [-Wimplicit-function-declaration] hashtb_entry DPht = (hashtb_entry ) aligned_alloc( 4, HASH_SIZE sizeof(struct hashtb_entry) ); //C11 ^~~~~ checked_malloc k022.c:740:23: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] hashtb_entry DPht = (hashtb_entry ) aligned_alloc( 4, HASH_SIZE sizeof(struct hashtb_entry) ); //C11 ^

Telariust commented 4 years ago

-std=c99 oh y, i often use aligned_alloc() (C2011) but I have stated C1999 compatibility. In this program, automatic alignment of the allocated memory does not matter, let's switch to the classic calloc(). fixed in 0.23