converting to new reply/cookie scheme

This commit is contained in:
Andrew Gallant (Ocelot)
2012-05-05 02:55:38 -04:00
parent a5d4ad6c9d
commit c222d406b0
4 changed files with 122 additions and 28 deletions

View File

@@ -158,6 +158,33 @@ func (e *UnaryOp) Initialize(p *Protocol) {
e.Expr.Initialize(p)
}
type Padding struct {
Expr Expression
}
func (e *Padding) Concrete() bool {
return e.Expr.Concrete()
}
func (e *Padding) Eval() uint {
return uint(pad(int(e.Expr.Eval())))
}
func (e *Padding) Reduce(prefix string) string {
if e.Concrete() {
return fmt.Sprintf("%d", e.Eval())
}
return fmt.Sprintf("pad(%s)", e.Expr.Reduce(prefix))
}
func (e *Padding) String() string {
return e.Reduce("")
}
func (e *Padding) Initialize(p *Protocol) {
e.Expr.Initialize(p)
}
type PopCount struct {
Expr Expression
}