From: Florent Kermarrec Date: Mon, 27 Apr 2015 19:04:18 +0000 (+0200) Subject: migen/genlib: avoid use of floating point in reverse_bytes X-Git-Tag: 24jan2021_ls180~2099^2~72 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=0da9311d70627e4f46319d9631881d50ed44fe5a;p=litex.git migen/genlib: avoid use of floating point in reverse_bytes --- diff --git a/migen/genlib/misc.py b/migen/genlib/misc.py index f13b93c3..b9e73a9a 100644 --- a/migen/genlib/misc.py +++ b/migen/genlib/misc.py @@ -1,5 +1,3 @@ -import math - from migen.fhdl.std import * from migen.fhdl.structure import _Operator @@ -67,7 +65,7 @@ def chooser(signal, shift, output, n=None, reverse=False): def reverse_bytes(signal): - n = math.ceil(flen(signal)/8) + n = (flen(signal)+7)//8 r = [] for i in reversed(range(n)): r.append(signal[i*8:min((i+1)*8, flen(signal))])