pbc
pbc copied to clipboard
fix: z_from_bytes func signature error
When I build pbc lib on my Mac M2 Pro.
I got this error message:
arith/multiz.c:563:17: error: incompatible function pointer types assigning to 'int (*)(element_ptr, const unsigned char *)' (aka 'int (*)(struct element_s *, const unsigned char *)') from 'int (struct element_s *, unsigned char *)' [-Wincompatible-function-pointer-types]
f->from_bytes = z_from_bytes;
It seems that the signature of z_from_bytes
in arith/multiz.c
and arith/z.c
did not match with the function pointer f->from_bytes
's signature defined in include/pbc_field.h
Thus, I make the following changes to fix this:
- add const to z_from_bytes's data variable to match the function signature
- use temporary pointer
ptr
to handle the neg operation