本文整理匯總了Golang中github.com/tsavola/wag/internal/loader.L.Varint32方法的典型用法代碼示例。如果您正苦於以下問題:Golang L.Varint32方法的具體用法?Golang L.Varint32怎麽用?Golang L.Varint32使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/tsavola/wag/internal/loader.L
的用法示例。
在下文中一共展示了L.Varint32方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: readInitExpr
func readInitExpr(load loader.L, m *Module) (valueBits uint64, t types.T) {
op := opcode(load.Byte())
switch op {
case opcodeI32Const:
valueBits = uint64(int64(load.Varint32()))
t = types.I32
case opcodeI64Const:
valueBits = uint64(load.Varint64())
t = types.I64
case opcodeF32Const:
valueBits = uint64(load.Uint32())
t = types.F32
case opcodeF64Const:
valueBits = load.Uint64()
t = types.F64
case opcodeGetGlobal:
i := load.Varuint32()
if i >= uint32(m.numImportGlobals) {
panic(fmt.Errorf("import global index out of bounds in initializer expression: %d", i))
}
g := m.globals[i]
valueBits = g.init
t = g.t
default:
panic(fmt.Errorf("unsupported operation in initializer expression: %s", op))
}
if op := opcode(load.Byte()); op != opcodeEnd {
panic(fmt.Errorf("unexpected operation in initializer expression when expecting end: %s", op))
}
return
}