X-Git-Url: http://git.silcnet.org/gitweb/?p=silc.git;a=blobdiff_plain;f=lib%2Fsilcmath%2Fsilcmp.h;h=ba18ae35bfe1f2d01af2fa818aba398614f0660b;hp=da72aa9129a5dac36d62d2cae239f37382178828;hb=ecb19b3983b3e74bc4aaa82277abd125c53c3623;hpb=382d15d447b7a95390decfa783836ae4fe255b3d diff --git a/lib/silcmath/silcmp.h b/lib/silcmath/silcmp.h index da72aa91..ba18ae35 100644 --- a/lib/silcmath/silcmp.h +++ b/lib/silcmath/silcmp.h @@ -106,10 +106,16 @@ size_t silc_mp_size(SilcMPInt *mp); * * DESCRIPTION * - * Return the size of the integer in base `base'. Note that this size - * is probably only an approximation. However, it is guaranteed that - * the returned size is always at least the size of the integer, however, - * it may be larger. + * Return the size of the integer in base `base'. + * + * NOTES + * + * For any other base but 2 this function usually returns only an + * approximated size in the base. It is however guaranteed that the + * the returned size is always at least the size of the integer or + * larger. + * + * For base 2 this returns the exact bit-size of the integer. * ***/ size_t silc_mp_sizeinbase(SilcMPInt *mp, int base); @@ -167,6 +173,11 @@ void silc_mp_set_si(SilcMPInt *dst, SilcInt32 si); * Set `dst' integer from string `str' of base `base'. The `dst' must * already be initialized. * + * NOTES + * + * For base 2 the string must be in ASCII bit presentation, not in + * binary. Use the silc_mp_bin2mp to decode binary into integer. + * ***/ void silc_mp_set_str(SilcMPInt *dst, const char *str, int base); @@ -195,6 +206,11 @@ SilcUInt32 silc_mp_get_ui(SilcMPInt *mp); * must already have space allocated. The function returns the same * as `str' or NULL on error. * + * NOTES + * + * For base 2 the returned string is in ASCII bit presentation, not + * in binary. Use the silc_mp_mp2bin to encode integer into binary. + * ***/ char *silc_mp_get_str(char *str, SilcMPInt *mp, int base);