Skip to content
Snippets Groups Projects
  • Damien George's avatar
    e7842744
    py/mpz: In mpz_as_str_inpl, convert always-false checks to assertions. · e7842744
    Damien George authored
    There are two checks that are always false so can be converted to (negated)
    assertions to save code space and execution time.  They are:
    
    1. The check of the str parameter, which is required to be non-NULL as per
       the original comment that it has enough space in it as calculated by
       mp_int_format_size.  And for all uses of this function str is indeed
       non-NULL.
    
    2. The check of the base parameter, which is already required to be between
       2 and 16 (inclusive) via the assertion in mp_int_format_size.
    e7842744
    History
    py/mpz: In mpz_as_str_inpl, convert always-false checks to assertions.
    Damien George authored
    There are two checks that are always false so can be converted to (negated)
    assertions to save code space and execution time.  They are:
    
    1. The check of the str parameter, which is required to be non-NULL as per
       the original comment that it has enough space in it as calculated by
       mp_int_format_size.  And for all uses of this function str is indeed
       non-NULL.
    
    2. The check of the base parameter, which is already required to be between
       2 and 16 (inclusive) via the assertion in mp_int_format_size.