utils_be.go 533 B

1234567891011121314151617181920212223
  1. //go:build armbe || arm64be || mips || mips64 || mips64p32 || ppc || ppc64 || sparc || sparc64 || s390 || s390x
  2. // +build armbe arm64be mips mips64 mips64p32 ppc ppc64 sparc sparc64 s390 s390x
  3. package yu_base64
  4. import (
  5. "unsafe"
  6. )
  7. //go:nosplit
  8. func bswap32(ptr uintptr) uint32 {
  9. return *(*uint32)(unsafe.Pointer(ptr))
  10. }
  11. //go:nosplit
  12. func stou32(cp uintptr, x uint32) {
  13. *(*uint32)(unsafe.Pointer(cp)) = reverseBytes32(x)
  14. }
  15. //go:nosplit
  16. func ctou32(cp uintptr) uint32 {
  17. return reverseBytes32(*(*uint32)(unsafe.Pointer(cp)))
  18. }