mirror of
https://github.com/ncruces/go-sqlite3.git
synced 2026-01-12 05:59:14 +00:00
Refactor.
This commit is contained in:
@@ -21,27 +21,6 @@ func View(mod api.Module, ptr uint32, size uint64) []byte {
|
||||
return buf
|
||||
}
|
||||
|
||||
func ReadUint8(mod api.Module, ptr uint32) uint8 {
|
||||
if ptr == 0 {
|
||||
panic(NilErr)
|
||||
}
|
||||
v, ok := mod.Memory().ReadByte(ptr)
|
||||
if !ok {
|
||||
panic(RangeErr)
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
||||
func WriteUint8(mod api.Module, ptr uint32, v uint8) {
|
||||
if ptr == 0 {
|
||||
panic(NilErr)
|
||||
}
|
||||
ok := mod.Memory().WriteByte(ptr, v)
|
||||
if !ok {
|
||||
panic(RangeErr)
|
||||
}
|
||||
}
|
||||
|
||||
func ReadUint32(mod api.Module, ptr uint32) uint32 {
|
||||
if ptr == 0 {
|
||||
panic(NilErr)
|
||||
@@ -84,18 +63,6 @@ func WriteUint64(mod api.Module, ptr uint32, v uint64) {
|
||||
}
|
||||
}
|
||||
|
||||
func ReadBool8(mod api.Module, ptr uint32) bool {
|
||||
return ReadUint8(mod, ptr) != 0
|
||||
}
|
||||
|
||||
func WriteBool8(mod api.Module, ptr uint32, v bool) {
|
||||
var b uint8
|
||||
if v {
|
||||
b = 1
|
||||
}
|
||||
WriteUint8(mod, ptr, b)
|
||||
}
|
||||
|
||||
func ReadFloat64(mod api.Module, ptr uint32) float64 {
|
||||
return math.Float64frombits(ReadUint64(mod, ptr))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user