Skip to content

Commit

Permalink
test ceildiv
Browse files Browse the repository at this point in the history
  • Loading branch information
chenyuxyz committed Dec 2, 2024
1 parent 509c4a5 commit bf4a790
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions tinygrad/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ def fromimport(mod, frm): return getattr(__import__(mod, fromlist=[frm]), frm)
def strip_parens(fst:str): return fst[1:-1] if fst[0] == '(' and fst[-1] == ')' and fst[1:-1].find('(') <= fst[1:-1].find(')') else fst
def ceildiv(num, amt):
ret = -(num//-amt)
if isinstance(ret, float): raise
return ret if not isinstance(ret, float) else int(ret)
def round_up(num:int, amt:int) -> int: return (num+amt-1)//amt * amt
def data64(data:Any) -> Tuple[Any, Any]: return (data >> 32, data & 0xFFFFFFFF) # Any is sint
Expand Down

0 comments on commit bf4a790

Please sign in to comment.