hdl.ast: actually implement the // operator.
This commit is contained in:
parent
450d7efdf2
commit
1621ceb65a
5 changed files with 29 additions and 5 deletions
|
|
@ -146,6 +146,10 @@ class _RHSValueCompiler(_ValueCompiler):
|
|||
return lambda state: normalize(lhs(state) - rhs(state), shape)
|
||||
if value.op == "*":
|
||||
return lambda state: normalize(lhs(state) * rhs(state), shape)
|
||||
if value.op == "//":
|
||||
def floordiv(lhs, rhs):
|
||||
return 0 if rhs == 0 else lhs // rhs
|
||||
return lambda state: normalize(floordiv(lhs(state), rhs(state)), shape)
|
||||
if value.op == "&":
|
||||
return lambda state: normalize(lhs(state) & rhs(state), shape)
|
||||
if value.op == "|":
|
||||
|
|
|
|||
|
|
@ -388,7 +388,7 @@ class _RHSValueCompiler(_ValueCompiler):
|
|||
(2, "+"): "$add",
|
||||
(2, "-"): "$sub",
|
||||
(2, "*"): "$mul",
|
||||
(2, "/"): "$div",
|
||||
(2, "//"): "$div",
|
||||
(2, "%"): "$mod",
|
||||
(2, "**"): "$pow",
|
||||
(2, "<<"): "$sshl",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue