When assertions is disable, there is a warning about unused check_index_range function

Make the check for a valid index range a macro, so the compiler doesn't
whine if it's not used, but it's available if it *is* used.
Fix some other shorten-64-to-32 casting error found by MSVC (64bits)

Thanks for Pascal
Merge branch 'alagoutte-h2-13-misc' into h2-13