You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
765 B

  1. // Copyright (c) 2016 Andreas Auernhammer. All rights reserved.
  2. // Use of this source code is governed by a license that can be
  3. // found in the LICENSE file.
  4. // +build amd64
  5. package skein
  6. import "unsafe"
  7. func bytesToBlock(block *[8]uint64, src []byte) {
  8. srcPtr := (*[8]uint64)(unsafe.Pointer(&src[0]))
  9. block[0] = srcPtr[0]
  10. block[1] = srcPtr[1]
  11. block[2] = srcPtr[2]
  12. block[3] = srcPtr[3]
  13. block[4] = srcPtr[4]
  14. block[5] = srcPtr[5]
  15. block[6] = srcPtr[6]
  16. block[7] = srcPtr[7]
  17. }
  18. func blockToBytes(dst []byte, block *[8]uint64) {
  19. dstPtr := (*[8]uint64)(unsafe.Pointer(&dst[0]))
  20. dstPtr[0] = block[0]
  21. dstPtr[1] = block[1]
  22. dstPtr[2] = block[2]
  23. dstPtr[3] = block[3]
  24. dstPtr[4] = block[4]
  25. dstPtr[5] = block[5]
  26. dstPtr[6] = block[6]
  27. dstPtr[7] = block[7]
  28. }