MCPcopy Create free account
hub / github.com/KnowingNothing/MatmulTutorial / FastDivmodU64Pow2

Class FastDivmodU64Pow2

cutlass.py/fast_math.py:14–31  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

12
13
14class FastDivmodU64Pow2:
15 def __init__(self, divisor=0) -> None:
16 self.divisor = divisor
17 self.shift_right = integer_log2(divisor)
18
19 def divide(self, dividend):
20 return dividend >> self.shift_right
21
22 def modulus(self, dividend):
23 return dividend & (self.divisor - 1)
24
25 def divmod(self, dividend):
26 quotient = self.divide(dividend)
27 remainder = self.modulus(dividend)
28 return quotient, remainder
29
30 def __call__(self, dividend):
31 return self.divmod(dividend)
32
33
34class FastDivmodU64:

Callers 1

_initializeMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected