Skip to content

Commit

Permalink
add Pointer() & Length() for MMBuffer
Browse files Browse the repository at this point in the history
  • Loading branch information
lingol committed Dec 17, 2020
1 parent 40c6daf commit d8416b5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Android/MMKV/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
ext.kotlin_version = '1.4.10'
ext.kotlin_version = '1.4.21'

repositories {
google()
Expand Down
10 changes: 10 additions & 0 deletions POSIX/golang/mmkv.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,16 @@ type MMBuffer struct {
length int
}

// the address of underlying memory
func (buffer MMBuffer) Pointer() uintptr {
return buffer.ptr
}

// the size of underlying memory
func (buffer MMBuffer) Length() int {
return buffer.length
}

// get byte slice view of underlying memory
// the slice is valid as long as MMBuffer.Destroy() not called
func (buffer MMBuffer) ByteSliceView() []byte {
Expand Down

0 comments on commit d8416b5

Please sign in to comment.