SHARE
TWEET

Untitled

a guest Jul 16th, 2019 67 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Take 2
  2.  
  3. // what you wrote
  4. var valueLength uint64
  5. valuePtr := keyHandle.StringDMA(&valueLength, rm.READ)
  6. var s string
  7. hdr := (*reflect.StringHeader)(unsafe.Pointer(&s))
  8. hdr.Data = uintptr(valuePtr)
  9. hdr.Len = value
  10. // use s, which points to redis string w/ correct length
  11.  
  12.  
  13. // what I thought you wrote
  14. valuePtr := keyHandle.StringDMA(&valueLength, rm.READ)
  15. hdr := (*reflect.StringHeader)(valuePtr)
  16. hdr.Data = uintptr(valuePtr)
  17. hdr.Len = value
  18. s := *(*string)(unsafe.Pointer(hdr))
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top