primary_weight

in lib/twitter_cldr/collation/implicit_collation_elements.rb [27:66]


        def primary_weight(code_point)
          byte0 = code_point - MIN_4_BOUNDARY

          if byte0 < 0
            byte1 = code_point / FINAL_3_COUNT
            byte0 = code_point % FINAL_3_COUNT

            byte2 = byte1 / MEDIAL_COUNT
            byte1 %= MEDIAL_COUNT

            
            byte0 = MIN_TRAIL + byte0 * FINAL_3_MULTIPLIER

            
            byte1 += MIN_TRAIL
            byte2 += MIN_PRIMARY

            (byte2 << 16) + (byte1 << 8) + byte0
          else
            byte1 = byte0 / FINAL_4_COUNT
            byte0 %= FINAL_4_COUNT

            byte2 = byte1 / MEDIAL_COUNT
            byte1 %= MEDIAL_COUNT

            byte3 = byte2 / MEDIAL_COUNT
            byte2 %= MEDIAL_COUNT

            
            byte0 = MIN_TRAIL + byte0 * FINAL_4_MULTIPLIER

            
            byte1 += MIN_TRAIL
            byte2 += MIN_TRAIL
            byte3 += MIN_4_PRIMARY

            (byte3 << 24) + (byte2 << 16) + (byte1 << 8) + byte0
          end
        end