blake2s_386.go 776 B

12345678910111213141516171819202122232425262728293031323334
  1. // Copyright 2016 The Go Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. // +build 386, !gccgo, !appengine
  5. package blake2s
  6. var (
  7. useSSSE3 = supportSSSE3()
  8. useSSE2 = supportSSE2()
  9. )
  10. //go:noescape
  11. func supportSSE2() bool
  12. //go:noescape
  13. func supportSSSE3() bool
  14. //go:noescape
  15. func hashBlocksSSE2(h *[8]uint32, c *[2]uint32, flag uint32, blocks []byte)
  16. //go:noescape
  17. func hashBlocksSSSE3(h *[8]uint32, c *[2]uint32, flag uint32, blocks []byte)
  18. func hashBlocks(h *[8]uint32, c *[2]uint32, flag uint32, blocks []byte) {
  19. if useSSSE3 {
  20. hashBlocksSSSE3(h, c, flag, blocks)
  21. } else if useSSE2 {
  22. hashBlocksSSE2(h, c, flag, blocks)
  23. } else {
  24. hashBlocksGeneric(h, c, flag, blocks)
  25. }
  26. }