Fix build with gmp < 4.2

See 3d6d863ccbd10d212352462b587ae1573af4f1d1
and acd7fcf55f81955e4837c750a5e45f83d3c55ba2
fix merge