Skip to content
Snippets Groups Projects
  • Arne Goedeke's avatar
    f1298df3
    Strings: correctly store character ranges · f1298df3
    Arne Goedeke authored
    Character ranges of strings are stored in two unsigned chars. For wide
    strings, the values between 0 and 255 represent blocks of 255 and
    (1<<24) characters, respectively.
    
    The previous code had several issues:
    
    1) After calculating the actual min/max values of the character range,
       these value were rounded up, which could lead to an overflow. The
       result was that both min and max could end up being 0. An example is
       the string (string)({ (1<<16)-1 }).
    2) The 32 bit case used blocks of 16 bit instead of 24 bit.
    f1298df3
    History
    Strings: correctly store character ranges
    Arne Goedeke authored
    Character ranges of strings are stored in two unsigned chars. For wide
    strings, the values between 0 and 255 represent blocks of 255 and
    (1<<24) characters, respectively.
    
    The previous code had several issues:
    
    1) After calculating the actual min/max values of the character range,
       these value were rounded up, which could lead to an overflow. The
       result was that both min and max could end up being 0. An example is
       the string (string)({ (1<<16)-1 }).
    2) The 32 bit case used blocks of 16 bit instead of 24 bit.