Skip to content

Commit

Permalink
Merge pull request #5 from yuvallanger/int-div
Browse files Browse the repository at this point in the history
Converting old style div `int(i / d)` into `i // d`
  • Loading branch information
eduardtomasek committed Feb 19, 2016
2 parents d418b0c + bfe0b12 commit 91da2a5
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions lzstring.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,18 +259,18 @@ def compressToBase64(self, string):

for i in range(0, strlen * 2, 3):
if (i % 2) == 0:
chr1 = ord(string[int(i / 2)]) >> 8
chr2 = ord(string[int(i / 2)]) & 255
chr1 = ord(string[i // 2]) >> 8
chr2 = ord(string[i // 2]) & 255

if (i / 2) + 1 < strlen:
chr3 = ord(string[int((i / 2) + 1)]) >> 8
chr3 = ord(string[(i // 2) + 1]) >> 8
else:
chr3 = float('NaN')
else:
chr1 = ord(string[int((i - 1) / 2)]) & 255
chr1 = ord(string[(i - 1) // 2]) & 255
if (i + 1) / 2 < strlen:
chr2 = ord(string[int((i + 1) / 2)]) >> 8
chr3 = ord(string[int((i + 1) / 2)]) & 255
chr2 = ord(string[(i + 1) // 2]) >> 8
chr3 = ord(string[(i + 1) // 2]) & 255
else:
chr2 = float('NaN')
chr3 = float('NaN')
Expand Down

0 comments on commit 91da2a5

Please sign in to comment.