Skip to content

Commit

Permalink
Use integer division
Browse files Browse the repository at this point in the history
  • Loading branch information
jaclarke committed Nov 10, 2021
1 parent 8e9230e commit 9032f8d
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions edgedb/datatypes/config_memory.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,15 @@ cdef class ConfigMemory:
int64_t bytes = self.bytes

if bytes >= PiB and bytes % PiB == 0:
return f'{int(bytes / PiB)}PiB'
return f'{bytes // PiB}PiB'
if bytes >= TiB and bytes % TiB == 0:
return f'{int(bytes / TiB)}TiB'
return f'{bytes // TiB}TiB'
if bytes >= GiB and bytes % GiB == 0:
return f'{int(bytes / GiB)}GiB'
return f'{bytes // GiB}GiB'
if bytes >= MiB and bytes % MiB == 0:
return f'{int(bytes / MiB)}MiB'
return f'{bytes // MiB}MiB'
if bytes >= KiB and bytes % KiB == 0:
return f'{int(bytes / KiB)}KiB'
return f'{bytes // KiB}KiB'
return f'{bytes}B'

@property
Expand Down

0 comments on commit 9032f8d

Please sign in to comment.