Documentation
¶
Overview ¶
Copyright Consensys Software Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
SPDX-License-Identifier: Apache-2.0
Copyright Consensys Software Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
SPDX-License-Identifier: Apache-2.0
Copyright Consensys Software Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
SPDX-License-Identifier: Apache-2.0
Copyright Consensys Software Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
SPDX-License-Identifier: Apache-2.0
Copyright Consensys Software Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
SPDX-License-Identifier: Apache-2.0
Copyright Consensys Software Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
SPDX-License-Identifier: Apache-2.0
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BitWidth ¶ added in v1.1.23
func BitWidth(e Expr, mapping schema.RegisterMap) (uint, bool)
BitWidth returns the minimum number of bits required to store any evaluation of this expression. In addition, it provides an indicator as to whether or not any evaluation could result in a negative value.
func Eval ¶ added in v1.1.23
Eval evaluates a set of zero or more expressions producing a set of zero or more values.
func RegistersRead ¶ added in v1.1.23
func RegistersRead(exprs ...Expr) []schema.RegisterId
RegistersRead determines the (unique) set of registers read by any expression in the given set of expressions.
Types ¶
type Add ¶
type Add struct {
Exprs []Expr
}
Add represents an expresion which adds one or more terms together.
func (*Add) Polynomial ¶
func (p *Add) Polynomial() agnostic.Polynomial
Polynomial implementation for the Expr interface.
func (*Add) RegistersRead ¶
RegistersRead implementation for the Expr interface.
func (*Add) ValueRange ¶
func (p *Add) ValueRange(mapping schema.RegisterMap) math.Interval
ValueRange implementation for the Expr interface.
type Const ¶
Const represents a constant value within an expresion.
func (*Const) Polynomial ¶
func (p *Const) Polynomial() agnostic.Polynomial
Polynomial implementation for the Expr interface.
func (*Const) RegistersRead ¶
RegistersRead implementation for the Expr interface.
func (*Const) ValueRange ¶
func (p *Const) ValueRange(mapping schema.RegisterMap) math.Interval
ValueRange implementation for the Expr interface.
type Expr ¶
type Expr interface { // Evaluate this expression in a given environment producing a given value. Eval([]big.Int) big.Int // Polynomial returns this expression flatterned into a polynomial form. Polynomial() agnostic.Polynomial // RegistersRead returns the set of registers read by this expression RegistersRead() bit.Set // String returns a string representation of this expression in a given base. String(mapping schema.RegisterMap) string // ValueRange returns the interval of values that this term can evaluate to. // For terms accessing registers, this is determined by the declared width of // the register. ValueRange(mapping schema.RegisterMap) math.Interval }
Expr represents an arbitrary expression used within an instruction.
type Mul ¶
type Mul struct {
Exprs []Expr
}
Mul represents an expresion which computes the product of one or more terms.
func (*Mul) Polynomial ¶
func (p *Mul) Polynomial() agnostic.Polynomial
Polynomial implementation for the Expr interface.
func (*Mul) RegistersRead ¶
RegistersRead implementation for the Expr interface.
func (*Mul) ValueRange ¶
func (p *Mul) ValueRange(mapping schema.RegisterMap) math.Interval
ValueRange implementation for the Expr interface.
type RegAccess ¶
type RegAccess struct {
Register io.RegisterId
}
RegAccess represents a register access within an expresion.
func (*RegAccess) Polynomial ¶
func (p *RegAccess) Polynomial() agnostic.Polynomial
Polynomial implementation for the Expr interface.
func (*RegAccess) RegistersRead ¶
RegistersRead implementation for the Expr interface.
func (*RegAccess) ValueRange ¶
func (p *RegAccess) ValueRange(mapping schema.RegisterMap) math.Interval
ValueRange implementation for the Expr interface.
type Sub ¶
type Sub struct {
Exprs []Expr
}
Sub represents an expresion which subtracts zero or more terms from a given term.
func (*Sub) Polynomial ¶
func (p *Sub) Polynomial() agnostic.Polynomial
Polynomial implementation for the Expr interface.
func (*Sub) RegistersRead ¶
RegistersRead implementation for the Expr interface.
func (*Sub) ValueRange ¶
func (p *Sub) ValueRange(mapping schema.RegisterMap) math.Interval
ValueRange implementation for the Expr interface.