libc_musl_linux_386.go 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. // Copyright 2023 The Libc 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. package libc // import "modernc.org/libc"
  5. import (
  6. "math/bits"
  7. "sync/atomic"
  8. "unsafe"
  9. )
  10. type long = int32
  11. type ulong = uint32
  12. // RawMem represents the biggest byte array the runtime can handle
  13. type RawMem [1<<31 - 1]byte
  14. func a_crash()
  15. func _a_crash(tls *TLS) {
  16. a_crash()
  17. }
  18. func a_cas(p uintptr, t, s int32) int32
  19. func _a_cas(tls *TLS, p uintptr, test, s int32) int32 {
  20. return a_cas(p, test, s)
  21. }
  22. func _a_store(tls *TLS, p uintptr, v int32) {
  23. atomic.StoreInt32((*int32)(unsafe.Pointer(p)), v)
  24. }
  25. func _a_clz_32(tls *TLS, x uint32) int32 {
  26. return int32(bits.LeadingZeros32(x))
  27. }
  28. func _a_ctz_32(tls *TLS, x uint32) int32 {
  29. return X__builtin_ctz(tls, x)
  30. }
  31. func a_or(p uintptr, v int32)
  32. func _a_or(tls *TLS, p uintptr, v int32) {
  33. a_or(p, v)
  34. }
  35. func _a_swap(tls *TLS, p uintptr, v int32) int32 {
  36. return atomic.SwapInt32((*int32)(unsafe.Pointer(p)), v)
  37. }