@@ -16,6 +16,7 @@ def indexedDynamicArrayElemSupported (elemTy : ParamType) : Bool :=
1616def normalizeEventWord (ty : ParamType) (expr : YulExpr) : YulExpr :=
1717 match ty with
1818 | ParamType.uint8 => YulExpr.call "and" [expr, YulExpr.lit 255 ]
19+ | ParamType.uint16 => YulExpr.call "and" [expr, YulExpr.lit 65535 ]
1920 | ParamType.address => YulExpr.call "and" [expr, YulExpr.hex addressMask]
2021 | ParamType.bool => yulToBool expr
2122 | ParamType.newtypeOf _ baseType => normalizeEventWord baseType expr
@@ -24,7 +25,7 @@ def normalizeEventWord (ty : ParamType) (expr : YulExpr) : YulExpr :=
2425partial def staticCompositeLeaves (baseName : String) (ty : ParamType) :
2526 List (ParamType × YulExpr) :=
2627 match ty with
27- | ParamType.uint256 | ParamType.int256 | ParamType.uint8 | ParamType.address | ParamType.bool | ParamType.bytes32 =>
28+ | ParamType.uint256 | ParamType.int256 | ParamType.uint8 | ParamType.uint16 | ParamType. address | ParamType.bool | ParamType.bytes32 =>
2829 [(ty, YulExpr.ident baseName)]
2930 | ParamType.fixedArray elemTy n =>
3031 (List.range n).flatMap fun i =>
@@ -41,7 +42,7 @@ partial def staticCompositeLeaves (baseName : String) (ty : ParamType) :
4142partial def staticCompositeLeafTypeOffsets
4243 (baseOffset : Nat) (ty : ParamType) : List (Nat × ParamType) :=
4344 match ty with
44- | ParamType.uint256 | ParamType.int256 | ParamType.uint8 | ParamType.address | ParamType.bool | ParamType.bytes32 =>
45+ | ParamType.uint256 | ParamType.int256 | ParamType.uint8 | ParamType.uint16 | ParamType. address | ParamType.bool | ParamType.bytes32 =>
4546 [(baseOffset, ty)]
4647 | ParamType.fixedArray elemTy n =>
4748 (List.range n).flatMap fun i =>
@@ -66,7 +67,7 @@ partial def compileIndexedInPlaceEncoding
6667 (srcBase dstBase : YulExpr) (stem : String) :
6768 Except String (List YulStmt × YulExpr) := do
6869 match ty with
69- | ParamType.uint256 | ParamType.int256 | ParamType.uint8 | ParamType.address | ParamType.bool | ParamType.bytes32 =>
70+ | ParamType.uint256 | ParamType.int256 | ParamType.uint8 | ParamType.uint16 | ParamType. address | ParamType.bool | ParamType.bytes32 =>
7071 let loaded := dynamicWordLoad dynamicSource srcBase
7172 pure ([
7273 YulStmt.expr (YulExpr.call "mstore" [dstBase, normalizeEventWord ty loaded])
0 commit comments