MemEqual performs byte to byte comparison.
(a unsafe.Pointer, b unsafe.Pointer, bytes int)
| 28 | |
| 29 | // MemEqual performs byte to byte comparison. |
| 30 | func MemEqual(a unsafe.Pointer, b unsafe.Pointer, bytes int) bool { |
| 31 | for i := 0; i < bytes; i++ { |
| 32 | if *(*uint8)(MemAccess(a, i)) != *(*uint8)(MemAccess(b, i)) { |
| 33 | return false |
| 34 | } |
| 35 | } |
| 36 | return true |
| 37 | } |
| 38 | |
| 39 | // MemCopy performs memory copy of specified bytes from src to dst |
| 40 | func MemCopy(dst unsafe.Pointer, src unsafe.Pointer, bytes int) { |