shitty bitfield packing code
This commit is contained in:
@@ -95,7 +95,7 @@ func NumLit(n int) *ast.BasicLit {
|
||||
}
|
||||
|
||||
func NumLitHex(n int) *ast.BasicLit {
|
||||
return NumLitStr(fmt.Sprintf("%X", n))
|
||||
return NumLitStr(fmt.Sprintf("0x%X", n))
|
||||
}
|
||||
|
||||
func NumLitStr(n string) *ast.BasicLit {
|
||||
@@ -194,6 +194,14 @@ func SubAssign(lhs, rhs ast.Expr) (s *ast.AssignStmt) {
|
||||
}
|
||||
}
|
||||
|
||||
func OrAssign(lhs, rhs ast.Expr) (s *ast.AssignStmt) {
|
||||
return &ast.AssignStmt{
|
||||
Lhs: []ast.Expr{lhs},
|
||||
Tok: token.OR_ASSIGN,
|
||||
Rhs: []ast.Expr{rhs},
|
||||
}
|
||||
}
|
||||
|
||||
func Exprs(exprs ...ast.Expr) []ast.Expr {
|
||||
return exprs
|
||||
}
|
||||
@@ -511,3 +519,9 @@ func LeftShift(lhs, rhs ast.Expr) *ast.BinaryExpr {
|
||||
Y: rhs,
|
||||
}
|
||||
}
|
||||
|
||||
func Grouping(e ast.Expr) *ast.ParenExpr {
|
||||
return &ast.ParenExpr{
|
||||
X: e,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user