MCPcopy
hub / github.com/uber/aresdb / MemSwap

Function MemSwap

utils/memory.go:47–53  ·  view source on GitHub ↗

MemSwap performs memory copy of specified bytes from src to dst

(dst unsafe.Pointer, src unsafe.Pointer, bytes int)

Source from the content-addressed store, hash-verified

45
46// MemSwap performs memory copy of specified bytes from src to dst
47func MemSwap(dst unsafe.Pointer, src unsafe.Pointer, bytes int) {
48 for i := 0; i < bytes; i++ {
49 tmp := *(*uint8)(MemAccess(dst, i))
50 *(*uint8)(MemAccess(dst, i)) = *(*uint8)(MemAccess(src, i))
51 *(*uint8)(MemAccess(src, i)) = tmp
52 }
53}
54
55// MemCmp performs memory comparison between two memory location start from offset
56// comparing bytes byte while skip offset byte

Callers 2

randomSwapMethod · 0.92
memory_test.goFile · 0.85

Calls 1

MemAccessFunction · 0.85

Tested by

no test coverage detected