Ignore:
Timestamp:
Sep 29, 2017, 9:59:40 AM (20 months ago)
Author:
cameron
Message:

Updates for Python 3; some refactoring

File:
1 edited

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/UCD-scripts/unicode_set.py

    r5153 r5653  
    2828quad_bits = 1 << log2_quad_bits
    2929mod_quad_bit_mask = quad_bits - 1
    30 UnicodeQuadCount = 0x110000 / quad_bits #  2**log2_quad_bits codepoints per quad
     30UnicodeQuadCount = int(0x110000 / quad_bits) #  2**log2_quad_bits codepoints per quad
    3131FullQuadMask = (1<<(quad_bits)) - 1
    3232run_bytes = 4
     
    6262   # printing
    6363   def showC(self, indent = 4):
    64       hex_specifier =  "%%#0%ix" % (quad_bits/4 + 2)
     64      hex_specifier =  "%%#0%ix" % (int(quad_bits/4) + 2)
    6565      runtype = {-1:"Full", 0:"Empty", 1: "Mixed"}
    6666      formatted_runs = ['{%s, %i}' % (runtype[r[0]], r[1]) for r in self.runs]
     
    7575
    7676   def bytes(self):
    77        return (len(self.runs) * run_bytes) + (len(self.quads) * quad_bits/8)
     77       return (len(self.runs) * run_bytes) + (len(self.quads) * int(quad_bits/8))
    7878
    7979
     
    154154
    155155def uset_member(s, codepoint):
    156    quad_no = codepoint / quad_bits
     156   quad_no = int(codepoint / quad_bits)
    157157   quad_val = 1 << (codepoint & mod_quad_bit_mask)
    158158   it = Uset_Iterator(s)   
     
    415415    f.close()
    416416    s = parse_UCD_set(lines)
    417     print s.showC(vname)
    418 
    419 
     417    print(s.showC(vname))
     418
     419
Note: See TracChangeset for help on using the changeset viewer.