herumi / mcl

a portable and fast pairing-based cryptography library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

constructing a field from __int128

quwenjie opened this issue · comments

Is it possible to construct an Fr from __int128?
I see the function only supports from long long int, which is 64bits.
How can this be achieved? Is it possible?

If your system is a little-endian architecture such as x64, then use setLittleEndianMod.

__int128 v;
Fr x;
x.setLittleEndianMod((const uint8_t*)&v, sizeof(v));

Remark: v must not be a negative integer.

Solved, thanks.