@ttsc/win32-arm64 0.33.0 → 0.34.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (1062) hide show
  1. package/bin/go/VERSION +2 -2
  2. package/bin/go/bin/go.exe +0 -0
  3. package/bin/go/bin/gofmt.exe +0 -0
  4. package/bin/go/lib/time/update.bash +2 -2
  5. package/bin/go/lib/time/zoneinfo.zip +0 -0
  6. package/bin/go/pkg/include/asm_ppc64x.h +0 -16
  7. package/bin/go/pkg/tool/windows_arm64/asm.exe +0 -0
  8. package/bin/go/pkg/tool/windows_arm64/cgo.exe +0 -0
  9. package/bin/go/pkg/tool/windows_arm64/compile.exe +0 -0
  10. package/bin/go/pkg/tool/windows_arm64/cover.exe +0 -0
  11. package/bin/go/pkg/tool/windows_arm64/fix.exe +0 -0
  12. package/bin/go/pkg/tool/windows_arm64/link.exe +0 -0
  13. package/bin/go/pkg/tool/windows_arm64/preprofile.exe +0 -0
  14. package/bin/go/pkg/tool/windows_arm64/vet.exe +0 -0
  15. package/bin/go/src/archive/tar/reader.go +2 -1
  16. package/bin/go/src/archive/zip/reader.go +5 -29
  17. package/bin/go/src/archive/zip/struct.go +5 -6
  18. package/bin/go/src/archive/zip/writer.go +120 -60
  19. package/bin/go/src/bufio/bufio.go +1 -1
  20. package/bin/go/src/bytes/buffer.go +3 -3
  21. package/bin/go/src/bytes/bytes.go +45 -25
  22. package/bin/go/src/compress/flate/deflate.go +512 -363
  23. package/bin/go/src/compress/flate/deflatefast.go +156 -262
  24. package/bin/go/src/compress/flate/dict_decoder.go +1 -4
  25. package/bin/go/src/compress/flate/huffman_bit_writer.go +673 -250
  26. package/bin/go/src/compress/flate/huffman_code.go +164 -92
  27. package/bin/go/src/compress/flate/level1.go +195 -0
  28. package/bin/go/src/compress/flate/level2.go +190 -0
  29. package/bin/go/src/compress/flate/level3.go +228 -0
  30. package/bin/go/src/compress/flate/level4.go +200 -0
  31. package/bin/go/src/compress/flate/level5.go +287 -0
  32. package/bin/go/src/compress/flate/level6.go +297 -0
  33. package/bin/go/src/compress/flate/load_store.go +43 -0
  34. package/bin/go/src/compress/flate/regmask_amd64.go +9 -0
  35. package/bin/go/src/compress/flate/regmask_other.go +11 -0
  36. package/bin/go/src/compress/flate/token.go +238 -26
  37. package/bin/go/src/compress/gzip/gzip.go +8 -0
  38. package/bin/go/src/compress/zlib/writer.go +12 -0
  39. package/bin/go/src/context/context.go +6 -5
  40. package/bin/go/src/crypto/cipher/gcm.go +0 -4
  41. package/bin/go/src/crypto/crypto.go +27 -4
  42. package/bin/go/src/crypto/des/const.go +1 -1
  43. package/bin/go/src/crypto/ecdsa/ecdsa.go +21 -4
  44. package/bin/go/src/crypto/ed25519/ed25519.go +13 -0
  45. package/bin/go/src/crypto/internal/boring/aes.go +2 -3
  46. package/bin/go/src/crypto/internal/cryptotest/aead.go +53 -0
  47. package/bin/go/src/crypto/internal/cryptotest/boundary.go +34 -0
  48. package/bin/go/src/crypto/internal/cryptotest/boundary_compat.go +16 -0
  49. package/bin/go/src/crypto/internal/cryptotest/fetchmodule.go +9 -3
  50. package/bin/go/src/crypto/internal/cryptotest/fips140.go +62 -3
  51. package/bin/go/src/crypto/internal/cryptotest/hash.go +14 -0
  52. package/bin/go/src/crypto/internal/cryptotest/wycheproof/_schema/go.mod +19 -0
  53. package/bin/go/src/crypto/internal/cryptotest/wycheproof/_schema/go.sum +27 -0
  54. package/bin/go/src/crypto/internal/cryptotest/wycheproof/_schema/schema_gen.go +151 -0
  55. package/bin/go/src/crypto/internal/cryptotest/wycheproof/schema.go +9792 -0
  56. package/bin/go/src/crypto/internal/cryptotest/wycheproof/schemaversion.go +11 -0
  57. package/bin/go/src/crypto/internal/cryptotest/wycheproof/wycheproof.go +165 -0
  58. package/bin/go/src/crypto/internal/cryptotest/x509limbo/_schema/go.mod +14 -0
  59. package/bin/go/src/crypto/internal/cryptotest/x509limbo/_schema/go.sum +25 -0
  60. package/bin/go/src/crypto/internal/cryptotest/x509limbo/_schema/schema_gen.go +125 -0
  61. package/bin/go/src/crypto/internal/cryptotest/x509limbo/schema.go +591 -0
  62. package/bin/go/src/crypto/internal/cryptotest/x509limbo/schemaversion.go +14 -0
  63. package/bin/go/src/crypto/internal/fips140/aes/_asm/ctr/go.mod +1 -1
  64. package/bin/go/src/crypto/internal/fips140/aes/_asm/standard/go.mod +1 -1
  65. package/bin/go/src/crypto/internal/fips140/aes/gcm/_asm/gcm/gcm_amd64_asm.go +36 -32
  66. package/bin/go/src/crypto/internal/fips140/aes/gcm/_asm/gcm/go.mod +5 -5
  67. package/bin/go/src/crypto/internal/fips140/aes/gcm/_asm/gcm/go.sum +8 -6
  68. package/bin/go/src/crypto/internal/fips140/aes/gcm/gcm_amd64.s +29 -17
  69. package/bin/go/src/crypto/internal/fips140/aes/gcm/gcm_arm64.s +73 -72
  70. package/bin/go/src/crypto/internal/fips140/aes/gcm/ghash.go +140 -124
  71. package/bin/go/src/crypto/internal/fips140/bigmod/nat.go +18 -0
  72. package/bin/go/src/crypto/internal/fips140/check/checktest/asm_loong64.s +23 -0
  73. package/bin/go/src/crypto/internal/fips140/check/checktest/asm_none.go +1 -1
  74. package/bin/go/src/crypto/internal/fips140/check/checktest/asm_stub.go +1 -1
  75. package/bin/go/src/crypto/internal/fips140/drbg/rand.go +12 -4
  76. package/bin/go/src/crypto/internal/fips140/ecdsa/ecdsa.go +17 -10
  77. package/bin/go/src/crypto/internal/fips140/edwards25519/field/_asm/fe_amd64_asm.go +0 -90
  78. package/bin/go/src/crypto/internal/fips140/edwards25519/field/fe.go +64 -97
  79. package/bin/go/src/crypto/internal/fips140/edwards25519/field/fe_amd64.go +0 -5
  80. package/bin/go/src/crypto/internal/fips140/edwards25519/field/fe_amd64.s +0 -167
  81. package/bin/go/src/crypto/internal/fips140/edwards25519/field/fe_amd64_noasm.go +0 -2
  82. package/bin/go/src/crypto/internal/fips140/edwards25519/field/fe_generic.go +57 -1
  83. package/bin/go/src/crypto/internal/fips140/edwards25519/scalarmult.go +3 -2
  84. package/bin/go/src/crypto/internal/fips140/mldsa/mldsa.go +31 -25
  85. package/bin/go/src/crypto/internal/fips140/mldsa/semiexpanded.go +2 -2
  86. package/bin/go/src/crypto/internal/fips140/nistec/_asm/go.mod +4 -4
  87. package/bin/go/src/crypto/internal/fips140/nistec/_asm/go.sum +6 -0
  88. package/bin/go/src/crypto/internal/fips140/nistec/_asm/p256_asm.go +1 -613
  89. package/bin/go/src/crypto/internal/fips140/nistec/p256.go +2 -2
  90. package/bin/go/src/crypto/internal/fips140/nistec/p256_asm.go +7 -6
  91. package/bin/go/src/crypto/internal/fips140/nistec/p256_asm_amd64.s +0 -503
  92. package/bin/go/src/crypto/internal/fips140/nistec/p256_asm_arm64.s +4 -429
  93. package/bin/go/src/crypto/internal/fips140/nistec/p256_ordinv.go +511 -47
  94. package/bin/go/src/crypto/internal/fips140/pbkdf2/pbkdf2.go +1 -1
  95. package/bin/go/src/crypto/internal/fips140/rsa/keygen.go +48 -46
  96. package/bin/go/src/crypto/internal/fips140/rsa/largeexponent.go +365 -0
  97. package/bin/go/src/crypto/internal/fips140/rsa/pkcs1v15.go +27 -0
  98. package/bin/go/src/crypto/internal/fips140/sha256/_asm/go.mod +1 -1
  99. package/bin/go/src/crypto/internal/fips140/sha3/_asm/go.mod +1 -1
  100. package/bin/go/src/crypto/internal/fips140/sha512/_asm/go.mod +1 -1
  101. package/bin/go/src/crypto/internal/fips140/subtle/constant_time.go +1 -1
  102. package/bin/go/src/crypto/internal/fips140/subtle/xor_asm.go +1 -1
  103. package/bin/go/src/crypto/internal/fips140/subtle/xor_riscv64.go +18 -0
  104. package/bin/go/src/crypto/internal/fips140/subtle/xor_riscv64.s +33 -2
  105. package/bin/go/src/crypto/internal/fips140deps/cpu/cpu.go +2 -0
  106. package/bin/go/src/crypto/internal/fips140deps/time/time.go +7 -4
  107. package/bin/go/src/crypto/internal/fips140only/fips140only.go +0 -7
  108. package/bin/go/src/crypto/internal/fips140only/random_fips140v1.0.go +17 -0
  109. package/bin/go/src/crypto/internal/fips140only/random_fips140v1.28.go +16 -0
  110. package/bin/go/src/crypto/internal/fips140test/acvp_capabilities_fips140v1.28.json +86 -0
  111. package/bin/go/src/crypto/internal/fips140test/acvp_test_fips140v1.28.config.json +58 -0
  112. package/bin/go/src/crypto/internal/rand/rand.go +14 -14
  113. package/bin/go/src/crypto/internal/rand/random_fips140v1.0.go +20 -0
  114. package/bin/go/src/crypto/internal/rand/random_fips140v1.28.go +19 -0
  115. package/bin/go/src/crypto/mldsa/mldsa.go +97 -0
  116. package/bin/go/src/crypto/mldsa/mldsa_fips140v1.0.go +116 -0
  117. package/bin/go/src/crypto/mldsa/mldsa_fips140v1.26.go +226 -0
  118. package/bin/go/src/crypto/mlkem/mlkem.go +8 -2
  119. package/bin/go/src/crypto/rsa/fips.go +26 -8
  120. package/bin/go/src/crypto/rsa/pkcs1v15.go +2 -2
  121. package/bin/go/src/crypto/rsa/rsa.go +25 -2
  122. package/bin/go/src/crypto/sha1/sha1block_decl.go +1 -1
  123. package/bin/go/src/crypto/sha1/sha1block_generic.go +1 -1
  124. package/bin/go/src/crypto/sha1/sha1block_loong64.s +24 -8
  125. package/bin/go/src/crypto/sha1/sha1block_riscv64.s +225 -0
  126. package/bin/go/src/crypto/sha3/sha3.go +3 -2
  127. package/bin/go/src/crypto/tls/alert.go +2 -0
  128. package/bin/go/src/crypto/tls/auth.go +31 -0
  129. package/bin/go/src/crypto/tls/bogo_config.json +12 -23
  130. package/bin/go/src/crypto/tls/cipher_suites.go +3 -11
  131. package/bin/go/src/crypto/tls/common.go +106 -59
  132. package/bin/go/src/crypto/tls/common_string.go +18 -5
  133. package/bin/go/src/crypto/tls/conn.go +33 -35
  134. package/bin/go/src/crypto/tls/defaults.go +26 -20
  135. package/bin/go/src/crypto/tls/defaults_fips140.go +9 -0
  136. package/bin/go/src/crypto/tls/ech.go +9 -4
  137. package/bin/go/src/crypto/tls/generate_cert.go +8 -2
  138. package/bin/go/src/crypto/tls/handshake_client.go +17 -17
  139. package/bin/go/src/crypto/tls/handshake_client_tls13.go +8 -3
  140. package/bin/go/src/crypto/tls/handshake_server.go +26 -19
  141. package/bin/go/src/crypto/tls/handshake_server_tls13.go +8 -5
  142. package/bin/go/src/crypto/tls/key_agreement.go +5 -1
  143. package/bin/go/src/crypto/tls/key_schedule.go +42 -17
  144. package/bin/go/src/crypto/tls/prf.go +1 -1
  145. package/bin/go/src/crypto/tls/quic.go +6 -7
  146. package/bin/go/src/crypto/tls/tls.go +25 -29
  147. package/bin/go/src/crypto/x509/cert_pool.go +8 -4
  148. package/bin/go/src/crypto/x509/constraints.go +5 -0
  149. package/bin/go/src/crypto/x509/parser.go +101 -15
  150. package/bin/go/src/crypto/x509/pkcs8.go +45 -4
  151. package/bin/go/src/crypto/x509/pkix/pkix.go +33 -9
  152. package/bin/go/src/crypto/x509/root.go +113 -0
  153. package/bin/go/src/crypto/x509/root_darwin.go +8 -4
  154. package/bin/go/src/crypto/x509/root_plan9.go +2 -23
  155. package/bin/go/src/crypto/x509/root_unix.go +0 -97
  156. package/bin/go/src/crypto/x509/root_windows.go +8 -3
  157. package/bin/go/src/crypto/x509/verify.go +43 -4
  158. package/bin/go/src/crypto/x509/x509.go +169 -30
  159. package/bin/go/src/database/sql/closemu.go +119 -0
  160. package/bin/go/src/database/sql/convert.go +63 -4
  161. package/bin/go/src/database/sql/driver/driver.go +26 -0
  162. package/bin/go/src/database/sql/driver/types.go +4 -0
  163. package/bin/go/src/database/sql/internal/sql.go +22 -0
  164. package/bin/go/src/database/sql/sql.go +89 -40
  165. package/bin/go/src/debug/buildinfo/buildinfo.go +0 -13
  166. package/bin/go/src/debug/dwarf/buf.go +7 -1
  167. package/bin/go/src/debug/dwarf/class_string.go +3 -2
  168. package/bin/go/src/debug/elf/file.go +80 -50
  169. package/bin/go/src/debug/elf/reader.go +1 -1
  170. package/bin/go/src/debug/gosym/symtab.go +26 -30
  171. package/bin/go/src/debug/macho/file.go +2 -2
  172. package/bin/go/src/debug/macho/reloctype_string.go +12 -8
  173. package/bin/go/src/debug/pe/file.go +6 -3
  174. package/bin/go/src/encoding/base32/base32.go +29 -31
  175. package/bin/go/src/encoding/base64/base64.go +24 -29
  176. package/bin/go/src/encoding/gob/decode.go +7 -1
  177. package/bin/go/src/encoding/gob/type.go +6 -6
  178. package/bin/go/src/encoding/hex/hex.go +6 -6
  179. package/bin/go/src/encoding/json/decode.go +4 -3
  180. package/bin/go/src/encoding/json/encode.go +1 -2
  181. package/bin/go/src/encoding/json/fold.go +1 -1
  182. package/bin/go/src/encoding/json/internal/internal.go +11 -1
  183. package/bin/go/src/encoding/json/internal/jsonflags/flags.go +17 -9
  184. package/bin/go/src/encoding/json/internal/jsonopts/options.go +52 -37
  185. package/bin/go/src/encoding/json/internal/jsonopts/options_format.go +124 -0
  186. package/bin/go/src/encoding/json/internal/jsontest/_embed/canada_geometry.json.zst +0 -0
  187. package/bin/go/src/encoding/json/internal/jsontest/_embed/citm_catalog.json.zst +0 -0
  188. package/bin/go/src/encoding/json/internal/jsontest/_embed/golang_source.json.zst +0 -0
  189. package/bin/go/src/encoding/json/internal/jsontest/_embed/string_escaped.json.zst +0 -0
  190. package/bin/go/src/encoding/json/internal/jsontest/_embed/string_unicode.json.zst +0 -0
  191. package/bin/go/src/encoding/json/internal/jsontest/_embed/synthea_fhir.json.zst +0 -0
  192. package/bin/go/src/encoding/json/internal/jsontest/_embed/twitter_status.json.zst +0 -0
  193. package/bin/go/src/encoding/json/internal/jsontest/testdata.go +10 -4
  194. package/bin/go/src/encoding/json/internal/jsonwire/decode.go +13 -36
  195. package/bin/go/src/encoding/json/internal/jsonwire/encode.go +7 -7
  196. package/bin/go/src/encoding/json/internal/jsonwire/wire.go +30 -38
  197. package/bin/go/src/encoding/json/jsontext/decode.go +49 -14
  198. package/bin/go/src/encoding/json/jsontext/doc.go +6 -11
  199. package/bin/go/src/encoding/json/jsontext/encode.go +55 -39
  200. package/bin/go/src/encoding/json/jsontext/errors.go +34 -3
  201. package/bin/go/src/encoding/json/jsontext/export.go +14 -0
  202. package/bin/go/src/encoding/json/jsontext/options.go +8 -8
  203. package/bin/go/src/encoding/json/jsontext/quote.go +2 -2
  204. package/bin/go/src/encoding/json/jsontext/state.go +14 -14
  205. package/bin/go/src/encoding/json/jsontext/token.go +246 -101
  206. package/bin/go/src/encoding/json/jsontext/value.go +31 -16
  207. package/bin/go/src/encoding/json/stream.go +14 -2
  208. package/bin/go/src/encoding/json/v2/arshal.go +100 -114
  209. package/bin/go/src/encoding/json/v2/arshal_any.go +6 -5
  210. package/bin/go/src/encoding/json/v2/arshal_default.go +292 -189
  211. package/bin/go/src/encoding/json/v2/{arshal_inlined.go → arshal_embedded.go} +14 -14
  212. package/bin/go/src/encoding/json/v2/arshal_funcs.go +28 -47
  213. package/bin/go/src/encoding/json/v2/arshal_methods.go +98 -29
  214. package/bin/go/src/encoding/json/v2/arshal_time.go +33 -13
  215. package/bin/go/src/encoding/json/v2/doc.go +40 -55
  216. package/bin/go/src/encoding/json/v2/errors.go +29 -9
  217. package/bin/go/src/encoding/json/v2/fields.go +83 -81
  218. package/bin/go/src/encoding/json/v2/intern.go +2 -2
  219. package/bin/go/src/encoding/json/v2/options.go +57 -41
  220. package/bin/go/src/encoding/json/v2_decode.go +21 -9
  221. package/bin/go/src/encoding/json/v2_encode.go +21 -10
  222. package/bin/go/src/encoding/json/v2_indent.go +2 -0
  223. package/bin/go/src/encoding/json/v2_inject.go +7 -4
  224. package/bin/go/src/encoding/json/v2_options.go +37 -30
  225. package/bin/go/src/encoding/json/v2_scanner.go +6 -1
  226. package/bin/go/src/encoding/json/v2_stream.go +49 -14
  227. package/bin/go/src/encoding/pem/pem.go +6 -2
  228. package/bin/go/src/fmt/doc.go +11 -1
  229. package/bin/go/src/fmt/print.go +69 -82
  230. package/bin/go/src/go/ast/ast.go +4 -4
  231. package/bin/go/src/go/ast/filter.go +1 -1
  232. package/bin/go/src/go/ast/scope.go +2 -2
  233. package/bin/go/src/go/build/build.go +1 -1
  234. package/bin/go/src/go/build/constraint/vers.go +4 -1
  235. package/bin/go/src/go/build/read.go +2 -2
  236. package/bin/go/src/go/constant/kind_string.go +3 -2
  237. package/bin/go/src/go/constant/value.go +26 -4
  238. package/bin/go/src/go/doc/comment/std.go +1 -0
  239. package/bin/go/src/go/importer/importer.go +4 -3
  240. package/bin/go/src/go/internal/gccgoimporter/parser.go +2 -0
  241. package/bin/go/src/go/internal/gcimporter/ureader.go +141 -56
  242. package/bin/go/src/go/parser/parser.go +11 -22
  243. package/bin/go/src/go/printer/math.go +28 -0
  244. package/bin/go/src/go/printer/nodes.go +28 -11
  245. package/bin/go/src/go/printer/printer.go +3 -1
  246. package/bin/go/src/go/scanner/errors.go +2 -0
  247. package/bin/go/src/go/scanner/scanner.go +40 -28
  248. package/bin/go/src/go/token/position.go +7 -16
  249. package/bin/go/src/go/types/alias.go +0 -18
  250. package/bin/go/src/go/types/api.go +4 -10
  251. package/bin/go/src/go/types/api_predicates.go +2 -2
  252. package/bin/go/src/go/types/assignments.go +44 -38
  253. package/bin/go/src/go/types/builtins.go +199 -168
  254. package/bin/go/src/go/types/call.go +155 -138
  255. package/bin/go/src/go/types/check.go +0 -83
  256. package/bin/go/src/go/types/const.go +22 -10
  257. package/bin/go/src/go/types/conversions.go +19 -19
  258. package/bin/go/src/go/types/cycles.go +29 -42
  259. package/bin/go/src/go/types/decl.go +33 -81
  260. package/bin/go/src/go/types/expr.go +191 -183
  261. package/bin/go/src/go/types/gotype.go +1 -0
  262. package/bin/go/src/go/types/hash.go +309 -0
  263. package/bin/go/src/go/types/index.go +91 -61
  264. package/bin/go/src/go/types/infer.go +11 -11
  265. package/bin/go/src/go/types/instantiate.go +27 -15
  266. package/bin/go/src/go/types/interface.go +2 -2
  267. package/bin/go/src/go/types/literals.go +56 -32
  268. package/bin/go/src/go/types/lookup.go +31 -14
  269. package/bin/go/src/go/types/named.go +58 -54
  270. package/bin/go/src/go/types/object.go +4 -3
  271. package/bin/go/src/go/types/operand.go +50 -34
  272. package/bin/go/src/go/types/range.go +19 -16
  273. package/bin/go/src/go/types/recording.go +24 -7
  274. package/bin/go/src/go/types/resolver.go +16 -18
  275. package/bin/go/src/go/types/scope.go +1 -15
  276. package/bin/go/src/go/types/selection.go +3 -1
  277. package/bin/go/src/go/types/signature.go +10 -11
  278. package/bin/go/src/go/types/stmt.go +34 -28
  279. package/bin/go/src/go/types/subst.go +82 -5
  280. package/bin/go/src/go/types/trie.go +93 -0
  281. package/bin/go/src/go/types/typelists.go +28 -0
  282. package/bin/go/src/go/types/typestring.go +5 -9
  283. package/bin/go/src/go/types/typexpr.go +17 -28
  284. package/bin/go/src/go/types/unify.go +12 -3
  285. package/bin/go/src/go/types/universe.go +12 -40
  286. package/bin/go/src/go/types/version.go +4 -0
  287. package/bin/go/src/go.mod +5 -5
  288. package/bin/go/src/go.sum +8 -8
  289. package/bin/go/src/hash/maphash/hasher.go +139 -0
  290. package/bin/go/src/hash/maphash/maphash.go +59 -4
  291. package/bin/go/src/html/template/attr_string.go +3 -2
  292. package/bin/go/src/html/template/delim_string.go +3 -2
  293. package/bin/go/src/html/template/element_string.go +3 -2
  294. package/bin/go/src/html/template/jsctx_string.go +3 -2
  295. package/bin/go/src/html/template/state_string.go +3 -2
  296. package/bin/go/src/html/template/template.go +7 -4
  297. package/bin/go/src/html/template/transition.go +1 -1
  298. package/bin/go/src/html/template/urlpart_string.go +3 -2
  299. package/bin/go/src/image/format.go +9 -0
  300. package/bin/go/src/image/gif/reader.go +18 -0
  301. package/bin/go/src/image/jpeg/huffman.go +22 -3
  302. package/bin/go/src/image/jpeg/reader.go +54 -29
  303. package/bin/go/src/image/jpeg/scan.go +68 -38
  304. package/bin/go/src/image/png/writer.go +8 -0
  305. package/bin/go/src/index/suffixarray/suffixarray.go +14 -6
  306. package/bin/go/src/internal/abi/abi_generic.go +1 -1
  307. package/bin/go/src/internal/abi/abi_s390x.go +0 -2
  308. package/bin/go/src/internal/abi/compiletype.go +30 -0
  309. package/bin/go/src/internal/abi/iface.go +13 -1
  310. package/bin/go/src/internal/abi/map.go +21 -3
  311. package/bin/go/src/internal/abi/type.go +136 -27
  312. package/bin/go/src/internal/buildcfg/exp.go +8 -8
  313. package/bin/go/src/internal/buildcfg/zbootstrap.go +1 -1
  314. package/bin/go/src/internal/bytealg/bytealg.go +16 -16
  315. package/bin/go/src/internal/bytealg/compare_s390x.s +0 -24
  316. package/bin/go/src/internal/bytealg/equal_s390x.s +0 -18
  317. package/bin/go/src/internal/bytealg/indexbyte_arm64.s +28 -0
  318. package/bin/go/src/internal/bytealg/indexbyte_s390x.s +0 -33
  319. package/bin/go/src/internal/coverage/encodemeta/encode.go +1 -1
  320. package/bin/go/src/internal/cpu/cpu.go +22 -7
  321. package/bin/go/src/internal/cpu/cpu_arm64.go +8 -1
  322. package/bin/go/src/internal/cpu/cpu_arm64.s +7 -0
  323. package/bin/go/src/internal/cpu/cpu_arm64_darwin.go +2 -0
  324. package/bin/go/src/internal/cpu/cpu_arm64_freebsd.go +2 -1
  325. package/bin/go/src/internal/cpu/cpu_arm64_hwcap.go +2 -0
  326. package/bin/go/src/internal/cpu/cpu_arm64_openbsd.go +6 -1
  327. package/bin/go/src/internal/cpu/cpu_arm64_other.go +1 -1
  328. package/bin/go/src/internal/cpu/cpu_arm64_windows.go +26 -0
  329. package/bin/go/src/internal/cpu/cpu_loong64.go +14 -2
  330. package/bin/go/src/internal/cpu/cpu_riscv64.go +10 -0
  331. package/bin/go/src/internal/cpu/cpu_riscv64_linux.go +21 -0
  332. package/bin/go/src/internal/cpu/cpu_windows.go +20 -0
  333. package/bin/go/src/internal/cpu/cpu_x86.go +2 -0
  334. package/bin/go/src/internal/filepathlite/path_windows.go +30 -17
  335. package/bin/go/src/internal/fuzz/fuzz.go +5 -1
  336. package/bin/go/src/internal/fuzz/mutator.go +2 -2
  337. package/bin/go/src/internal/fuzz/worker.go +1 -1
  338. package/bin/go/src/internal/gate/gate.go +76 -0
  339. package/bin/go/src/internal/godebugs/table.go +29 -10
  340. package/bin/go/src/internal/goexperiment/exp_mapsplitgroup_off.go +8 -0
  341. package/bin/go/src/internal/goexperiment/exp_mapsplitgroup_on.go +8 -0
  342. package/bin/go/src/internal/goexperiment/flags.go +5 -3
  343. package/bin/go/src/internal/goversion/goversion.go +1 -1
  344. package/bin/go/src/internal/lazyregexp/lazyre.go +4 -0
  345. package/bin/go/src/internal/nettest/conn.go +437 -0
  346. package/bin/go/src/internal/nettest/listener.go +148 -0
  347. package/bin/go/src/internal/nettest/packetconn.go +250 -0
  348. package/bin/go/src/internal/nettest/queue.go +33 -0
  349. package/bin/go/src/internal/pkgbits/syncmarker_string.go +4 -4
  350. package/bin/go/src/internal/pkgbits/version.go +27 -1
  351. package/bin/go/src/internal/platform/supported.go +8 -10
  352. package/bin/go/src/internal/platform/zosarch.go +1 -3
  353. package/bin/go/src/internal/poll/fd_mutex.go +49 -10
  354. package/bin/go/src/internal/poll/fd_unix.go +6 -1
  355. package/bin/go/src/internal/poll/fd_windows.go +175 -191
  356. package/bin/go/src/internal/poll/fd_writev_libc.go +1 -1
  357. package/bin/go/src/internal/poll/fd_writev_unix.go +1 -1
  358. package/bin/go/src/internal/poll/file_plan9.go +4 -4
  359. package/bin/go/src/internal/poll/sendfile_windows.go +1 -3
  360. package/bin/go/src/internal/poll/splice_linux.go +1 -1
  361. package/bin/go/src/internal/profile/encode.go +1 -1
  362. package/bin/go/src/internal/profile/profile.go +5 -3
  363. package/bin/go/src/internal/profilerecord/profilerecord.go +2 -2
  364. package/bin/go/src/internal/reflectlite/value.go +1 -15
  365. package/bin/go/src/internal/runtime/atomic/atomic_386.go +0 -6
  366. package/bin/go/src/internal/runtime/atomic/atomic_amd64.go +0 -6
  367. package/bin/go/src/internal/runtime/atomic/atomic_andor_generic.go +0 -11
  368. package/bin/go/src/internal/runtime/atomic/atomic_arm.go +0 -6
  369. package/bin/go/src/internal/runtime/atomic/atomic_loong64.go +2 -2
  370. package/bin/go/src/internal/runtime/atomic/atomic_loong64.s +22 -11
  371. package/bin/go/src/internal/runtime/atomic/atomic_mipsx.go +0 -10
  372. package/bin/go/src/internal/runtime/atomic/atomic_riscv64.s +4 -4
  373. package/bin/go/src/internal/runtime/atomic/atomic_s390x.go +0 -6
  374. package/bin/go/src/internal/runtime/atomic/atomic_wasm.go +0 -31
  375. package/bin/go/src/internal/runtime/atomic/linkname.go +34 -0
  376. package/bin/go/src/internal/runtime/exithook/hooks.go +0 -4
  377. package/bin/go/src/internal/runtime/gc/scan/expand_amd64.s +2285 -2285
  378. package/bin/go/src/internal/runtime/gc/scan/mkasm.go +1 -1
  379. package/bin/go/src/internal/runtime/gc/scan/scan_amd64.go +2 -1
  380. package/bin/go/src/internal/runtime/gc/scan/scan_amd64.s +4 -2
  381. package/bin/go/src/internal/runtime/maps/group.go +22 -13
  382. package/bin/go/src/internal/runtime/maps/map.go +35 -14
  383. package/bin/go/src/internal/runtime/maps/memhash_386.s +408 -0
  384. package/bin/go/src/internal/runtime/maps/memhash_aes.go +38 -0
  385. package/bin/go/src/internal/runtime/maps/memhash_aes_asm.go +24 -0
  386. package/bin/go/src/internal/runtime/maps/memhash_aes_simd.go +49 -0
  387. package/bin/go/src/internal/runtime/maps/memhash_align_check.go +10 -0
  388. package/bin/go/src/internal/runtime/maps/memhash_align_nocheck.go +16 -0
  389. package/bin/go/src/internal/runtime/maps/memhash_amd64.s +426 -0
  390. package/bin/go/src/internal/runtime/maps/memhash_arm64.s +366 -0
  391. package/bin/go/src/internal/runtime/maps/memhash_noaes.go +43 -0
  392. package/bin/go/src/internal/runtime/maps/memhash_nosimd_amd64.s +33 -0
  393. package/bin/go/src/internal/runtime/maps/runtime.go +37 -88
  394. package/bin/go/src/internal/runtime/maps/runtime_alg.go +93 -0
  395. package/bin/go/src/internal/runtime/maps/runtime_fast32.go +111 -97
  396. package/bin/go/src/internal/runtime/maps/runtime_fast64.go +137 -98
  397. package/bin/go/src/internal/runtime/maps/runtime_faststr.go +96 -89
  398. package/bin/go/src/{runtime/hash32.go → internal/runtime/maps/runtime_hash32.go} +8 -10
  399. package/bin/go/src/{runtime/hash64.go → internal/runtime/maps/runtime_hash64.go} +8 -8
  400. package/bin/go/src/internal/runtime/maps/table.go +66 -3
  401. package/bin/go/src/internal/runtime/math/math.go +0 -21
  402. package/bin/go/src/internal/runtime/startlinetest/func_amd64.s +2 -1
  403. package/bin/go/src/internal/runtime/sys/dit_arm64.go +3 -0
  404. package/bin/go/src/internal/runtime/sys/dit_arm64.s +16 -3
  405. package/bin/go/src/internal/runtime/syscall/linux/asm_linux_s390x.s +0 -23
  406. package/bin/go/src/internal/runtime/syscall/windows/asm_windows_386.s +7 -4
  407. package/bin/go/src/internal/runtime/syscall/windows/asm_windows_amd64.s +10 -8
  408. package/bin/go/src/internal/runtime/syscall/windows/asm_windows_arm64.s +0 -1
  409. package/bin/go/src/internal/runtime/syscall/windows/defs_windows.go +4 -0
  410. package/bin/go/src/internal/runtime/syscall/windows/syscall_windows.go +7 -9
  411. package/bin/go/src/internal/strconv/atof.go +69 -42
  412. package/bin/go/src/internal/strconv/atoi.go +1 -0
  413. package/bin/go/src/internal/strconv/ftoa.go +329 -357
  414. package/bin/go/src/internal/strconv/itoa.go +53 -59
  415. package/bin/go/src/internal/strconv/pow10gen.go +15 -3
  416. package/bin/go/src/internal/strconv/pow10tab.go +670 -670
  417. package/bin/go/src/internal/strconv/uscale.go +290 -0
  418. package/bin/go/src/internal/stringslite/strings.go +14 -42
  419. package/bin/go/src/internal/syscall/unix/asm_openbsd.s +0 -2
  420. package/bin/go/src/internal/syscall/unix/at.go +1 -1
  421. package/bin/go/src/internal/syscall/unix/at_fstatat.go +1 -1
  422. package/bin/go/src/internal/syscall/unix/at_libc2.go +1 -1
  423. package/bin/go/src/internal/syscall/unix/at_openbsd.go +0 -2
  424. package/bin/go/src/internal/syscall/unix/faccessat_bsd.go +1 -1
  425. package/bin/go/src/internal/syscall/unix/faccessat_openbsd.go +0 -2
  426. package/bin/go/src/internal/syscall/windows/at_windows.go +5 -5
  427. package/bin/go/src/internal/syscall/windows/net_windows.go +1 -0
  428. package/bin/go/src/internal/syscall/windows/string_windows.go +6 -3
  429. package/bin/go/src/internal/syscall/windows/syscall_windows.go +2 -0
  430. package/bin/go/src/internal/syscall/windows/types_windows.go +89 -4
  431. package/bin/go/src/internal/syscall/windows/zsyscall_windows.go +7 -0
  432. package/bin/go/src/internal/testenv/testenv.go +24 -1
  433. package/bin/go/src/internal/trace/event.go +1 -1
  434. package/bin/go/src/internal/trace/tracev2/events.go +2 -0
  435. package/bin/go/src/internal/trace/traceviewer/pprof.go +1 -0
  436. package/bin/go/src/internal/types/errors/generrordocs.go +1 -1
  437. package/bin/go/src/io/fs/fs.go +4 -1
  438. package/bin/go/src/io/fs/glob.go +1 -1
  439. package/bin/go/src/io/fs/readdir.go +3 -3
  440. package/bin/go/src/io/fs/readfile.go +3 -3
  441. package/bin/go/src/io/fs/stat.go +1 -1
  442. package/bin/go/src/io/fs/sub.go +4 -2
  443. package/bin/go/src/iter/iter.go +2 -2
  444. package/bin/go/src/log/slog/handler.go +0 -1
  445. package/bin/go/src/log/slog/json_handler.go +7 -1
  446. package/bin/go/src/log/slog/logger.go +16 -0
  447. package/bin/go/src/log/slog/text_handler.go +10 -1
  448. package/bin/go/src/log/slog/value.go +1 -1
  449. package/bin/go/src/log/syslog/doc.go +5 -0
  450. package/bin/go/src/math/abs.go +1 -1
  451. package/bin/go/src/math/big/accuracy_string.go +4 -4
  452. package/bin/go/src/math/big/arith.go +1 -1
  453. package/bin/go/src/math/big/arith_loong64.s +2 -4
  454. package/bin/go/src/math/big/float.go +2 -0
  455. package/bin/go/src/math/big/ftoa.go +11 -5
  456. package/bin/go/src/math/big/int.go +84 -1
  457. package/bin/go/src/math/big/intconv.go +19 -4
  458. package/bin/go/src/math/big/internal/asmgen/loong64.go +2 -0
  459. package/bin/go/src/math/big/nat.go +68 -17
  460. package/bin/go/src/math/big/natdiv.go +8 -5
  461. package/bin/go/src/math/big/roundingmode_string.go +3 -2
  462. package/bin/go/src/math/copysign.go +1 -2
  463. package/bin/go/src/math/exp2_asm.go +1 -1
  464. package/bin/go/src/math/exp2_noasm.go +1 -1
  465. package/bin/go/src/math/exp_asm.go +1 -1
  466. package/bin/go/src/math/exp_loong64.s +4 -12
  467. package/bin/go/src/math/exp_noasm.go +1 -1
  468. package/bin/go/src/math/exp_riscv64.s +236 -0
  469. package/bin/go/src/math/nextafter.go +4 -2
  470. package/bin/go/src/math/pow10.go +1 -1
  471. package/bin/go/src/math/rand/v2/rand.go +14 -4
  472. package/bin/go/src/mime/type.go +3 -2
  473. package/bin/go/src/net/dial.go +10 -6
  474. package/bin/go/src/net/dnsclient_unix.go +37 -8
  475. package/bin/go/src/net/dnsconfig.go +6 -0
  476. package/bin/go/src/net/fd_plan9.go +13 -6
  477. package/bin/go/src/net/fd_unix.go +3 -7
  478. package/bin/go/src/net/fd_windows.go +4 -9
  479. package/bin/go/src/net/file_plan9.go +1 -1
  480. package/bin/go/src/net/file_posix.go +1 -5
  481. package/bin/go/src/net/http/client.go +21 -4
  482. package/bin/go/src/net/http/clientconn.go +20 -1
  483. package/bin/go/src/net/http/clone.go +1 -10
  484. package/bin/go/src/net/http/cookie.go +5 -6
  485. package/bin/go/src/net/http/cookiejar/jar.go +6 -4
  486. package/bin/go/src/net/http/fcgi/fcgi.go +1 -2
  487. package/bin/go/src/net/http/fs.go +8 -1
  488. package/bin/go/src/net/http/http.go +29 -12
  489. package/bin/go/src/net/http/http2.go +561 -0
  490. package/bin/go/src/net/http/httptest/server.go +305 -60
  491. package/bin/go/src/net/http/httptrace/trace.go +78 -27
  492. package/bin/go/src/net/http/httputil/reverseproxy.go +0 -30
  493. package/bin/go/src/net/http/internal/common.go +14 -0
  494. package/bin/go/src/net/http/internal/http2/api.go +161 -0
  495. package/bin/go/src/net/http/internal/http2/ascii.go +53 -0
  496. package/bin/go/src/net/http/internal/http2/ciphers.go +641 -0
  497. package/bin/go/src/net/http/internal/http2/client_conn_pool.go +285 -0
  498. package/bin/go/src/net/http/internal/http2/config.go +118 -0
  499. package/bin/go/src/net/http/internal/http2/databuffer.go +146 -0
  500. package/bin/go/src/net/http/internal/http2/errors.go +173 -0
  501. package/bin/go/src/net/http/internal/http2/flow.go +175 -0
  502. package/bin/go/src/net/http/internal/http2/frame.go +1905 -0
  503. package/bin/go/src/net/http/internal/http2/gotrack.go +181 -0
  504. package/bin/go/src/net/http/internal/http2/http2.go +403 -0
  505. package/bin/go/src/net/http/internal/http2/pipe.go +184 -0
  506. package/bin/go/src/net/http/internal/http2/server.go +3238 -0
  507. package/bin/go/src/net/http/internal/http2/transport.go +3267 -0
  508. package/bin/go/src/net/http/internal/http2/write.go +380 -0
  509. package/bin/go/src/net/http/internal/http2/writesched.go +289 -0
  510. package/bin/go/src/net/http/internal/http2/writesched_priority_rfc9218.go +224 -0
  511. package/bin/go/src/net/http/internal/http2/writesched_roundrobin.go +119 -0
  512. package/bin/go/src/net/http/internal/httpcommon/httpcommon.go +8 -0
  513. package/bin/go/src/net/http/internal/httpsfv/httpsfv.go +666 -0
  514. package/bin/go/src/net/http/internal/sniff.go +304 -0
  515. package/bin/go/src/net/http/omithttp2.go +28 -49
  516. package/bin/go/src/net/http/pprof/pprof.go +11 -17
  517. package/bin/go/src/net/http/request.go +30 -3
  518. package/bin/go/src/net/http/response.go +6 -2
  519. package/bin/go/src/net/http/server.go +366 -144
  520. package/bin/go/src/net/http/sniff.go +2 -289
  521. package/bin/go/src/net/http/transfer.go +64 -21
  522. package/bin/go/src/net/http/transport.go +288 -83
  523. package/bin/go/src/net/ip.go +4 -0
  524. package/bin/go/src/net/ipsock_plan9.go +4 -4
  525. package/bin/go/src/net/ipsock_posix.go +8 -2
  526. package/bin/go/src/net/lookup.go +10 -0
  527. package/bin/go/src/net/lookup_windows.go +1 -1
  528. package/bin/go/src/net/mail/message.go +8 -3
  529. package/bin/go/src/net/net.go +2 -0
  530. package/bin/go/src/net/netip/netip.go +68 -61
  531. package/bin/go/src/net/sock_posix.go +1 -4
  532. package/bin/go/src/net/textproto/reader.go +11 -3
  533. package/bin/go/src/net/udpsock_plan9.go +2 -7
  534. package/bin/go/src/net/unixsock.go +11 -3
  535. package/bin/go/src/net/url/url.go +33 -0
  536. package/bin/go/src/os/dir_darwin.go +7 -0
  537. package/bin/go/src/os/exec/exec.go +16 -2
  538. package/bin/go/src/os/exec.go +1 -0
  539. package/bin/go/src/os/file.go +8 -1
  540. package/bin/go/src/os/root_windows.go +5 -1
  541. package/bin/go/src/os/signal/doc.go +3 -2
  542. package/bin/go/src/os/signal/signal.go +18 -6
  543. package/bin/go/src/os/statat_unix.go +5 -1
  544. package/bin/go/src/path/filepath/path.go +4 -0
  545. package/bin/go/src/reflect/asm_s390x.s +0 -10
  546. package/bin/go/src/reflect/iter.go +13 -13
  547. package/bin/go/src/reflect/makefunc.go +2 -1
  548. package/bin/go/src/reflect/map.go +61 -18
  549. package/bin/go/src/reflect/type.go +63 -46
  550. package/bin/go/src/reflect/value.go +59 -16
  551. package/bin/go/src/regexp/exec.go +5 -5
  552. package/bin/go/src/regexp/regexp.go +382 -319
  553. package/bin/go/src/regexp/syntax/parse.go +19 -10
  554. package/bin/go/src/runtime/HACKING.md +19 -0
  555. package/bin/go/src/runtime/_mkmalloc/constants.go +6 -4
  556. package/bin/go/src/runtime/_mkmalloc/go.mod +1 -1
  557. package/bin/go/src/runtime/_mkmalloc/mkmalloc.go +405 -64
  558. package/bin/go/src/runtime/alg.go +21 -53
  559. package/bin/go/src/runtime/asm_386.s +11 -461
  560. package/bin/go/src/runtime/asm_amd64.s +30 -537
  561. package/bin/go/src/runtime/asm_arm.s +4 -39
  562. package/bin/go/src/runtime/asm_arm64.s +15 -428
  563. package/bin/go/src/runtime/asm_loong64.s +37 -47
  564. package/bin/go/src/runtime/asm_mips64x.s +15 -15
  565. package/bin/go/src/runtime/asm_mipsx.s +0 -15
  566. package/bin/go/src/runtime/asm_ppc64x.h +0 -16
  567. package/bin/go/src/runtime/asm_ppc64x.s +13 -59
  568. package/bin/go/src/runtime/asm_riscv64.s +30 -91
  569. package/bin/go/src/runtime/asm_s390x.s +49 -49
  570. package/bin/go/src/runtime/asm_wasm.s +0 -15
  571. package/bin/go/src/runtime/atomic_riscv64.s +1 -1
  572. package/bin/go/src/runtime/cgo/abi_riscv64.h +72 -0
  573. package/bin/go/src/runtime/cgo/asm_riscv64.s +7 -48
  574. package/bin/go/src/runtime/cgo/callbacks.go +0 -42
  575. package/bin/go/src/runtime/cgo/callbacks_unix.go +58 -0
  576. package/bin/go/src/runtime/cgo/cgo.go +6 -3
  577. package/bin/go/src/runtime/cgo/gcc_aix_ppc64.S +21 -9
  578. package/bin/go/src/runtime/cgo/gcc_android.c +0 -26
  579. package/bin/go/src/runtime/cgo/gcc_clearenv.c +1 -1
  580. package/bin/go/src/runtime/cgo/gcc_fatalf.c +14 -3
  581. package/bin/go/src/runtime/cgo/{gcc_libinit.c → gcc_libinit_unix.c} +18 -65
  582. package/bin/go/src/runtime/cgo/gcc_libinit_windows.c +23 -35
  583. package/bin/go/src/runtime/cgo/gcc_linux_ppc64x.S +16 -7
  584. package/bin/go/src/runtime/cgo/gcc_netbsd.c +8 -56
  585. package/bin/go/src/runtime/cgo/gcc_s390x.S +13 -4
  586. package/bin/go/src/runtime/cgo/gcc_sigaction.c +1 -1
  587. package/bin/go/src/runtime/cgo/gcc_unix.c +63 -0
  588. package/bin/go/src/runtime/cgo/gcc_util.c +0 -19
  589. package/bin/go/src/runtime/cgo/handle.go +3 -0
  590. package/bin/go/src/runtime/cgo/libcgo.h +7 -10
  591. package/bin/go/src/runtime/cgo/libcgo_unix.h +2 -10
  592. package/bin/go/src/runtime/cgo/pthread_unix.c +138 -0
  593. package/bin/go/src/runtime/cgo/sigaction.go +1 -1
  594. package/bin/go/src/runtime/cgo/windows.go +18 -1
  595. package/bin/go/src/runtime/cgo_ppc64x.go +1 -1
  596. package/bin/go/src/runtime/cgo_sigaction.go +1 -1
  597. package/bin/go/src/runtime/cgocall.go +10 -2
  598. package/bin/go/src/runtime/chan.go +2 -16
  599. package/bin/go/src/runtime/coro.go +2 -2
  600. package/bin/go/src/runtime/cpuflags.go +4 -3
  601. package/bin/go/src/runtime/debug/garbage.go +6 -6
  602. package/bin/go/src/runtime/debug/mod.go +1 -1
  603. package/bin/go/src/runtime/debug/stack.go +1 -1
  604. package/bin/go/src/runtime/debugcall.go +0 -3
  605. package/bin/go/src/runtime/error.go +6 -0
  606. package/bin/go/src/runtime/extern.go +5 -3
  607. package/bin/go/src/runtime/heapdump.go +1 -1
  608. package/bin/go/src/runtime/iface.go +20 -10
  609. package/bin/go/src/runtime/libinit.go +48 -0
  610. package/bin/go/src/runtime/lock_js.go +4 -2
  611. package/bin/go/src/runtime/lock_spinbit.go +13 -12
  612. package/bin/go/src/runtime/lock_wasip1.go +4 -2
  613. package/bin/go/src/runtime/lockrank.go +24 -21
  614. package/bin/go/src/runtime/lockrank_off.go +5 -2
  615. package/bin/go/src/runtime/lockrank_on.go +8 -7
  616. package/bin/go/src/runtime/malloc.go +10 -26
  617. package/bin/go/src/runtime/malloc_generated.go +819 -8628
  618. package/bin/go/src/runtime/malloc_stubs.go +187 -197
  619. package/bin/go/src/runtime/malloc_tables_generated.go +16 -882
  620. package/bin/go/src/runtime/map.go +4 -4
  621. package/bin/go/src/runtime/mbitmap.go +3 -1
  622. package/bin/go/src/runtime/mem.go +2 -6
  623. package/bin/go/src/runtime/mem_sbrk.go +4 -0
  624. package/bin/go/src/runtime/memclr_s390x.s +0 -5
  625. package/bin/go/src/runtime/memmove_s390x.s +0 -7
  626. package/bin/go/src/runtime/metrics/doc.go +5 -29
  627. package/bin/go/src/runtime/metrics/sample.go +3 -0
  628. package/bin/go/src/runtime/metrics.go +3 -2
  629. package/bin/go/src/runtime/mgc.go +41 -25
  630. package/bin/go/src/runtime/mgcmark.go +5 -0
  631. package/bin/go/src/runtime/mgcmark_greenteagc.go +1 -1
  632. package/bin/go/src/runtime/mgcpacer.go +1 -3
  633. package/bin/go/src/runtime/mgcscavenge.go +1 -1
  634. package/bin/go/src/runtime/mheap.go +1 -10
  635. package/bin/go/src/runtime/mklockrank.go +6 -1
  636. package/bin/go/src/runtime/mkpreempt.go +7 -0
  637. package/bin/go/src/runtime/mprof.go +12 -23
  638. package/bin/go/src/runtime/os2_aix.go +3 -3
  639. package/bin/go/src/runtime/os3_solaris.go +10 -0
  640. package/bin/go/src/runtime/os_aix.go +9 -2
  641. package/bin/go/src/runtime/os_darwin.go +3 -8
  642. package/bin/go/src/runtime/os_dragonfly.go +10 -0
  643. package/bin/go/src/runtime/os_js.go +10 -0
  644. package/bin/go/src/runtime/os_linux32.go +19 -6
  645. package/bin/go/src/runtime/os_netbsd.go +10 -0
  646. package/bin/go/src/runtime/os_openbsd.go +10 -0
  647. package/bin/go/src/runtime/os_plan9.go +10 -0
  648. package/bin/go/src/runtime/os_wasip1.go +10 -0
  649. package/bin/go/src/runtime/os_windows.go +45 -12
  650. package/bin/go/src/runtime/os_workdir_ios_arm64.go +98 -0
  651. package/bin/go/src/runtime/os_workdir_stub.go +9 -0
  652. package/bin/go/src/runtime/panic.go +93 -8
  653. package/bin/go/src/runtime/plugin.go +1 -3
  654. package/bin/go/src/runtime/pprof/pprof.go +11 -14
  655. package/bin/go/src/runtime/pprof/protomem.go +8 -15
  656. package/bin/go/src/runtime/preempt_loong64.s +8 -4
  657. package/bin/go/src/runtime/preempt_noxreg.go +2 -0
  658. package/bin/go/src/runtime/preempt_xreg.go +29 -2
  659. package/bin/go/src/runtime/print.go +9 -1
  660. package/bin/go/src/runtime/proc.go +68 -17
  661. package/bin/go/src/runtime/race_riscv64.s +40 -83
  662. package/bin/go/src/runtime/race_s390x.s +0 -16
  663. package/bin/go/src/runtime/rand.go +40 -12
  664. package/bin/go/src/runtime/{rt0_linux_ppc64le.s → rt0_linux_ppc64x.s} +12 -2
  665. package/bin/go/src/runtime/runtime-gdb.py +13 -2
  666. package/bin/go/src/runtime/runtime1.go +69 -18
  667. package/bin/go/src/runtime/runtime2.go +23 -22
  668. package/bin/go/src/runtime/secret/secret.go +7 -2
  669. package/bin/go/src/runtime/secret.go +27 -9
  670. package/bin/go/src/runtime/secret_nosecret.go +1 -1
  671. package/bin/go/src/runtime/sigaction.go +1 -1
  672. package/bin/go/src/runtime/signal_unix.go +5 -3
  673. package/bin/go/src/runtime/softfloat64.go +7 -2
  674. package/bin/go/src/runtime/string.go +4 -1
  675. package/bin/go/src/runtime/stubs.go +14 -4
  676. package/bin/go/src/runtime/stubs_amd64.go +4 -0
  677. package/bin/go/src/runtime/stubs_arm.go +10 -1
  678. package/bin/go/src/runtime/stubs_arm64.go +13 -0
  679. package/bin/go/src/runtime/stubs_loong64.go +18 -0
  680. package/bin/go/src/runtime/stubs_mips64x.go +9 -0
  681. package/bin/go/src/runtime/stubs_mipsx.go +11 -0
  682. package/bin/go/src/runtime/stubs_ppc64x.go +15 -0
  683. package/bin/go/src/runtime/stubs_riscv64.go +13 -0
  684. package/bin/go/src/runtime/stubs_s390x.go +18 -0
  685. package/bin/go/src/runtime/symtab.go +15 -16
  686. package/bin/go/src/runtime/synctest.go +2 -4
  687. package/bin/go/src/runtime/sys_aix_ppc64.s +9 -0
  688. package/bin/go/src/runtime/sys_darwin.go +2 -20
  689. package/bin/go/src/runtime/sys_darwin_amd64.s +1 -4
  690. package/bin/go/src/runtime/sys_darwin_arm64.s +3 -6
  691. package/bin/go/src/runtime/sys_freebsd_riscv64.s +2 -2
  692. package/bin/go/src/runtime/sys_ios_arm64.go +151 -0
  693. package/bin/go/src/runtime/sys_ios_arm64.s +78 -0
  694. package/bin/go/src/runtime/sys_linux_amd64.s +7 -1
  695. package/bin/go/src/runtime/sys_linux_loong64.s +8 -14
  696. package/bin/go/src/runtime/sys_linux_ppc64x.s +0 -12
  697. package/bin/go/src/runtime/sys_linux_riscv64.s +2 -2
  698. package/bin/go/src/runtime/sys_openbsd.go +1 -1
  699. package/bin/go/src/runtime/sys_openbsd_riscv64.s +16 -16
  700. package/bin/go/src/runtime/syscall_windows.go +2 -6
  701. package/bin/go/src/runtime/time.go +19 -57
  702. package/bin/go/src/runtime/trace/subscribe.go +0 -3
  703. package/bin/go/src/runtime/traceback.go +90 -13
  704. package/bin/go/src/runtime/traceregion.go +3 -3
  705. package/bin/go/src/runtime/tracestring.go +5 -0
  706. package/bin/go/src/runtime/type.go +85 -15
  707. package/bin/go/src/runtime/utf8.go +2 -2
  708. package/bin/go/src/simd/archsimd/_gen/go.mod +2 -2
  709. package/bin/go/src/simd/archsimd/_gen/go.sum +2 -2
  710. package/bin/go/src/simd/archsimd/_gen/main.go +106 -15
  711. package/bin/go/src/simd/archsimd/_gen/midway/comments.yaml +151 -0
  712. package/bin/go/src/simd/archsimd/_gen/midway/intersect_simd_ops.go +836 -0
  713. package/bin/go/src/simd/archsimd/_gen/sgutil/asbits.go +139 -0
  714. package/bin/go/src/simd/archsimd/_gen/sgutil/compare_natural.go +73 -0
  715. package/bin/go/src/simd/archsimd/_gen/sgutil/formatted_files.go +66 -0
  716. package/bin/go/src/simd/archsimd/_gen/sgutil/insert_ordered_map.go +159 -0
  717. package/bin/go/src/simd/archsimd/_gen/sgutil/merge_generic_ops.go +245 -0
  718. package/bin/go/src/simd/archsimd/_gen/simdgen/arch.go +173 -0
  719. package/bin/go/src/simd/archsimd/_gen/simdgen/arm64/emit.go +166 -0
  720. package/bin/go/src/simd/archsimd/_gen/simdgen/arm64/instruction.go +642 -0
  721. package/bin/go/src/simd/archsimd/_gen/simdgen/arm64/load.go +54 -0
  722. package/bin/go/src/simd/archsimd/_gen/simdgen/arm64/operands.go +406 -0
  723. package/bin/go/src/simd/archsimd/_gen/simdgen/etetest.sh +1 -1
  724. package/bin/go/src/simd/archsimd/_gen/simdgen/gen_simdGenericOps.go +19 -52
  725. package/bin/go/src/simd/archsimd/_gen/simdgen/gen_simdIntrinsics.go +162 -98
  726. package/bin/go/src/simd/archsimd/_gen/simdgen/gen_simdMachineOps.go +50 -19
  727. package/bin/go/src/simd/archsimd/_gen/simdgen/gen_simdTypes.go +198 -140
  728. package/bin/go/src/simd/archsimd/_gen/simdgen/gen_simdrules.go +278 -57
  729. package/bin/go/src/simd/archsimd/_gen/simdgen/gen_simdssa.go +133 -68
  730. package/bin/go/src/simd/archsimd/_gen/simdgen/gen_utility.go +163 -30
  731. package/bin/go/src/simd/archsimd/_gen/simdgen/go_amd64.yaml +1 -0
  732. package/bin/go/src/simd/archsimd/_gen/simdgen/go_arm64.yaml +1 -0
  733. package/bin/go/src/simd/archsimd/_gen/simdgen/godefs.go +113 -15
  734. package/bin/go/src/simd/archsimd/_gen/simdgen/main.go +62 -17
  735. package/bin/go/src/simd/archsimd/_gen/simdgen/ops/AddSub/categories.yaml +12 -12
  736. package/bin/go/src/simd/archsimd/_gen/simdgen/ops/AddSub/{go.yaml → go_amd64.yaml} +12 -12
  737. package/bin/go/src/simd/archsimd/_gen/simdgen/ops/AddSub/go_arm64.yaml +91 -0
  738. package/bin/go/src/simd/archsimd/_gen/simdgen/ops/BitwiseLogic/categories.yaml +11 -3
  739. package/bin/go/src/simd/archsimd/_gen/simdgen/ops/BitwiseLogic/go_arm64.yaml +43 -0
  740. package/bin/go/src/simd/archsimd/_gen/simdgen/ops/Compares/go_arm64.yaml +81 -0
  741. package/bin/go/src/simd/archsimd/_gen/simdgen/ops/Converts/categories.yaml +11 -6
  742. package/bin/go/src/simd/archsimd/_gen/simdgen/ops/Converts/{go.yaml → go_amd64.yaml} +8 -8
  743. package/bin/go/src/simd/archsimd/_gen/simdgen/ops/Converts/go_arm64.yaml +358 -0
  744. package/bin/go/src/simd/archsimd/_gen/simdgen/ops/FPonlyArith/categories.yaml +5 -5
  745. package/bin/go/src/simd/archsimd/_gen/simdgen/ops/FPonlyArith/{go.yaml → go_amd64.yaml} +4 -4
  746. package/bin/go/src/simd/archsimd/_gen/simdgen/ops/FPonlyArith/go_arm64.yaml +52 -0
  747. package/bin/go/src/simd/archsimd/_gen/simdgen/ops/GaloisField/categories.yaml +29 -11
  748. package/bin/go/src/simd/archsimd/_gen/simdgen/ops/GaloisField/{go.yaml → go_amd64.yaml} +1 -0
  749. package/bin/go/src/simd/archsimd/_gen/simdgen/ops/GaloisField/go_arm64.yaml +10 -0
  750. package/bin/go/src/simd/archsimd/_gen/simdgen/ops/IntOnlyArith/categories.yaml +2 -5
  751. package/bin/go/src/simd/archsimd/_gen/simdgen/ops/IntOnlyArith/{go.yaml → go_amd64.yaml} +2 -3
  752. package/bin/go/src/simd/archsimd/_gen/simdgen/ops/IntOnlyArith/go_arm64.yaml +35 -0
  753. package/bin/go/src/simd/archsimd/_gen/simdgen/ops/MLOps/categories.yaml +5 -8
  754. package/bin/go/src/simd/archsimd/_gen/simdgen/ops/MLOps/{go.yaml → go_amd64.yaml} +7 -5
  755. package/bin/go/src/simd/archsimd/_gen/simdgen/ops/MLOps/go_arm64.yaml +31 -0
  756. package/bin/go/src/simd/archsimd/_gen/simdgen/ops/MinMax/go_arm64.yaml +61 -0
  757. package/bin/go/src/simd/archsimd/_gen/simdgen/ops/Moves/categories.yaml +79 -23
  758. package/bin/go/src/simd/archsimd/_gen/simdgen/ops/Moves/{go.yaml → go_amd64.yaml} +213 -104
  759. package/bin/go/src/simd/archsimd/_gen/simdgen/ops/Moves/go_arm64.yaml +264 -0
  760. package/bin/go/src/simd/archsimd/_gen/simdgen/ops/Mul/categories.yaml +6 -2
  761. package/bin/go/src/simd/archsimd/_gen/simdgen/ops/Mul/{go.yaml → go_amd64.yaml} +3 -3
  762. package/bin/go/src/simd/archsimd/_gen/simdgen/ops/Mul/go_arm64.yaml +38 -0
  763. package/bin/go/src/simd/archsimd/_gen/simdgen/ops/NegAbs/categories.yaml +7 -0
  764. package/bin/go/src/simd/archsimd/_gen/simdgen/ops/NegAbs/go_arm64.yaml +36 -0
  765. package/bin/go/src/simd/archsimd/_gen/simdgen/ops/Others/categories.yaml +5 -1
  766. package/bin/go/src/simd/archsimd/_gen/simdgen/ops/Others/go_arm64.yaml +19 -0
  767. package/bin/go/src/simd/archsimd/_gen/simdgen/ops/Reduce/categories.yaml +16 -0
  768. package/bin/go/src/simd/archsimd/_gen/simdgen/ops/Reduce/go_arm64.yaml +71 -0
  769. package/bin/go/src/simd/archsimd/_gen/simdgen/ops/ShiftRotate/categories.yaml +156 -41
  770. package/bin/go/src/simd/archsimd/_gen/simdgen/ops/ShiftRotate/go_amd64.yaml +299 -0
  771. package/bin/go/src/simd/archsimd/_gen/simdgen/ops/ShiftRotate/go_arm64.yaml +202 -0
  772. package/bin/go/src/simd/archsimd/_gen/simdgen/types.yaml +2 -0
  773. package/bin/go/src/simd/archsimd/_gen/simdgen/xed.go +44 -11
  774. package/bin/go/src/simd/archsimd/_gen/tmplgen/main.go +668 -123
  775. package/bin/go/src/simd/archsimd/_gen/unify/closure.go +1 -1
  776. package/bin/go/src/simd/archsimd/_gen/unify/env.go +35 -3
  777. package/bin/go/src/simd/archsimd/_gen/unify/yaml.go +4 -4
  778. package/bin/go/src/simd/archsimd/_gen/wasmgen/main.go +2064 -0
  779. package/bin/go/src/simd/archsimd/clmul_arm64.go +79 -0
  780. package/bin/go/src/simd/archsimd/clmul_emulated.go +103 -0
  781. package/bin/go/src/simd/archsimd/compare_gen_arm64.go +155 -0
  782. package/bin/go/src/simd/archsimd/cpu.go +1 -1
  783. package/bin/go/src/simd/archsimd/cpu_other.go +21 -0
  784. package/bin/go/src/simd/archsimd/doc.go +0 -2
  785. package/bin/go/src/simd/archsimd/dummy.s +1 -1
  786. package/bin/go/src/simd/archsimd/generate.go +1 -1
  787. package/bin/go/src/simd/archsimd/internal/test_helpers/checkslices.go +2 -2
  788. package/bin/go/src/simd/archsimd/maskmerge_gen_amd64.go +330 -0
  789. package/bin/go/src/simd/archsimd/maskmerge_gen_arm64.go +167 -0
  790. package/bin/go/src/simd/archsimd/ops_amd64.go +4210 -2475
  791. package/bin/go/src/simd/archsimd/ops_arm64.go +2186 -0
  792. package/bin/go/src/simd/archsimd/ops_emulated_amd64.go +205 -0
  793. package/bin/go/src/simd/archsimd/ops_emulated_wasm.go +212 -0
  794. package/bin/go/src/simd/archsimd/ops_internal_amd64.go +500 -56
  795. package/bin/go/src/simd/archsimd/ops_internal_arm64.go +234 -0
  796. package/bin/go/src/simd/archsimd/ops_wasm.go +1795 -0
  797. package/bin/go/src/simd/archsimd/other_gen_amd64.go +576 -72
  798. package/bin/go/src/simd/archsimd/other_gen_arm64.go +519 -0
  799. package/bin/go/src/simd/archsimd/shuffles_amd64.go +217 -76
  800. package/bin/go/src/simd/archsimd/slice_gen_amd64.go +594 -532
  801. package/bin/go/src/simd/archsimd/slice_gen_arm64.go +125 -0
  802. package/bin/go/src/simd/archsimd/slicepart_128.go +302 -0
  803. package/bin/go/src/simd/archsimd/slicepart_amd64.go +36 -235
  804. package/bin/go/src/simd/archsimd/slicepart_arm64.go +217 -0
  805. package/bin/go/src/simd/archsimd/slicepart_wasm.go +217 -0
  806. package/bin/go/src/simd/archsimd/string.go +1 -1
  807. package/bin/go/src/simd/archsimd/types_amd64.go +165 -341
  808. package/bin/go/src/simd/archsimd/types_arm64.go +224 -0
  809. package/bin/go/src/simd/archsimd/types_wasm.go +354 -0
  810. package/bin/go/src/simd/archsimd/unsafe_helpers.go +60 -0
  811. package/bin/go/src/simd/doc.go +91 -0
  812. package/bin/go/src/simd/dummy.s +7 -0
  813. package/bin/go/src/simd/internal/bridge/decls_amd64.go +4085 -0
  814. package/bin/go/src/simd/internal/bridge/decls_arm64.go +1369 -0
  815. package/bin/go/src/simd/internal/bridge/decls_wasm.go +1369 -0
  816. package/bin/go/src/simd/internal/bridge/import_hook.go +13 -0
  817. package/bin/go/src/simd/internal/bridge/simd_emulated.go +3275 -0
  818. package/bin/go/src/simd/internal/bridge/simd_types_emulated.go +95 -0
  819. package/bin/go/src/simd/internal/bridge/tofrom_128.go +65 -0
  820. package/bin/go/src/simd/internal/bridge/tofrom_amd64.go +123 -0
  821. package/bin/go/src/simd/internal/bridge/tofrom_emulated.go +63 -0
  822. package/bin/go/src/simd/midway_amd64.go +34 -0
  823. package/bin/go/src/simd/midway_arm64.go +22 -0
  824. package/bin/go/src/simd/midway_common.go +138 -0
  825. package/bin/go/src/simd/midway_wasm.go +13 -0
  826. package/bin/go/src/simd/simd_emulated.go +3275 -0
  827. package/bin/go/src/simd/simd_stubs.go +1041 -0
  828. package/bin/go/src/simd/simd_types.go +96 -0
  829. package/bin/go/src/simd/tofrom_amd64.go +374 -0
  830. package/bin/go/src/simd/tofrom_arm64.go +290 -0
  831. package/bin/go/src/simd/tofrom_wasm.go +290 -0
  832. package/bin/go/src/slices/slices.go +9 -7
  833. package/bin/go/src/strconv/isprint.go +81 -51
  834. package/bin/go/src/strings/builder.go +1 -1
  835. package/bin/go/src/strings/strings.go +44 -35
  836. package/bin/go/src/sync/atomic/doc.go +7 -0
  837. package/bin/go/src/sync/cond.go +4 -2
  838. package/bin/go/src/sync/pool.go +6 -15
  839. package/bin/go/src/sync/runtime2_lockrank.go +1 -2
  840. package/bin/go/src/syscall/exec_bsd.go +3 -3
  841. package/bin/go/src/syscall/exec_libc2.go +1 -1
  842. package/bin/go/src/syscall/exec_linux.go +7 -2
  843. package/bin/go/src/syscall/fs_js.go +9 -4
  844. package/bin/go/src/syscall/fs_wasip1.go +6 -0
  845. package/bin/go/src/syscall/js/js.go +2 -2
  846. package/bin/go/src/syscall/linkname_bsd.go +8 -0
  847. package/bin/go/src/syscall/linkname_libc.go +1 -1
  848. package/bin/go/src/syscall/linkname_openbsd.go +0 -2
  849. package/bin/go/src/syscall/mkall.sh +6 -17
  850. package/bin/go/src/syscall/syscall_aix.go +5 -0
  851. package/bin/go/src/syscall/syscall_linux_386.go +9 -0
  852. package/bin/go/src/syscall/syscall_linux_amd64.go +5 -0
  853. package/bin/go/src/syscall/syscall_linux_arm.go +4 -0
  854. package/bin/go/src/syscall/syscall_linux_arm64.go +3 -0
  855. package/bin/go/src/syscall/syscall_linux_loong64.go +3 -0
  856. package/bin/go/src/syscall/syscall_linux_mipsx.go +4 -0
  857. package/bin/go/src/syscall/syscall_linux_riscv64.go +3 -0
  858. package/bin/go/src/syscall/syscall_linux_s390x.go +5 -0
  859. package/bin/go/src/syscall/syscall_openbsd.go +77 -2
  860. package/bin/go/src/syscall/syscall_plan9.go +25 -0
  861. package/bin/go/src/syscall/syscall_solaris.go +11 -0
  862. package/bin/go/src/syscall/syscall_unix.go +19 -0
  863. package/bin/go/src/syscall/syscall_windows.go +1 -1
  864. package/bin/go/src/testing/synctest/synctest.go +21 -0
  865. package/bin/go/src/testing/testing.go +211 -52
  866. package/bin/go/src/text/template/parse/lex.go +6 -6
  867. package/bin/go/src/text/template/parse/node.go +21 -16
  868. package/bin/go/src/text/template/parse/parse.go +23 -6
  869. package/bin/go/src/text/template/template.go +5 -3
  870. package/bin/go/src/time/format.go +3 -0
  871. package/bin/go/src/time/sleep.go +0 -33
  872. package/bin/go/src/time/tick.go +3 -2
  873. package/bin/go/src/time/time.go +2 -2
  874. package/bin/go/src/time/tzdata/zzipdata.go +1 -1
  875. package/bin/go/src/time/zoneinfo.go +5 -4
  876. package/bin/go/src/time/zoneinfo_read.go +1 -1
  877. package/bin/go/src/unicode/tables.go +898 -417
  878. package/bin/go/src/uuid/uuid.go +273 -0
  879. package/bin/go/src/vendor/golang.org/x/crypto/chacha20poly1305/chacha20poly1305_amd64.go +3 -3
  880. package/bin/go/src/vendor/golang.org/x/crypto/chacha20poly1305/chacha20poly1305_amd64.s +2066 -6598
  881. package/bin/go/src/vendor/golang.org/x/crypto/hkdf/hkdf.go +100 -0
  882. package/bin/go/src/vendor/golang.org/x/net/dns/dnsmessage/message.go +5 -4
  883. package/bin/go/src/vendor/golang.org/x/net/http/httpproxy/proxy.go +4 -4
  884. package/bin/go/src/vendor/golang.org/x/net/http3/http3.go +46 -0
  885. package/bin/go/src/vendor/golang.org/x/net/idna/{idna10.0.0.go → idna.go} +133 -35
  886. package/bin/go/src/vendor/golang.org/x/net/idna/punycode.go +4 -1
  887. package/bin/go/src/vendor/golang.org/x/net/idna/tables15.0.0.go +1 -1
  888. package/bin/go/src/vendor/golang.org/x/net/idna/tables17.0.0.go +5302 -0
  889. package/bin/go/src/vendor/golang.org/x/net/internal/http3/body.go +231 -0
  890. package/bin/go/src/vendor/golang.org/x/net/internal/http3/conn.go +131 -0
  891. package/bin/go/src/vendor/golang.org/x/net/internal/http3/doc.go +10 -0
  892. package/bin/go/src/vendor/golang.org/x/net/internal/http3/errors.go +102 -0
  893. package/bin/go/src/vendor/golang.org/x/net/internal/http3/http3.go +95 -0
  894. package/bin/go/src/vendor/golang.org/x/net/internal/http3/qpack.go +356 -0
  895. package/bin/go/src/vendor/golang.org/x/net/internal/http3/qpack_decode.go +81 -0
  896. package/bin/go/src/vendor/golang.org/x/net/internal/http3/qpack_encode.go +61 -0
  897. package/bin/go/src/vendor/golang.org/x/net/internal/http3/qpack_static.go +142 -0
  898. package/bin/go/src/vendor/golang.org/x/net/internal/http3/quic.go +40 -0
  899. package/bin/go/src/vendor/golang.org/x/net/internal/http3/roundtrip.go +423 -0
  900. package/bin/go/src/vendor/golang.org/x/net/internal/http3/server.go +866 -0
  901. package/bin/go/src/vendor/golang.org/x/net/internal/http3/settings.go +66 -0
  902. package/bin/go/src/vendor/golang.org/x/net/internal/http3/stream.go +260 -0
  903. package/bin/go/src/vendor/golang.org/x/net/internal/http3/transport.go +333 -0
  904. package/bin/go/src/vendor/golang.org/x/net/internal/http3/varint.go +23 -0
  905. package/bin/go/src/vendor/golang.org/x/net/internal/httpcommon/ascii.go +53 -0
  906. package/bin/go/src/vendor/golang.org/x/net/internal/httpcommon/headermap.go +115 -0
  907. package/bin/go/src/vendor/golang.org/x/net/internal/httpcommon/request.go +475 -0
  908. package/bin/go/src/vendor/golang.org/x/net/internal/quic/quicwire/wire.go +150 -0
  909. package/bin/go/src/vendor/golang.org/x/net/quic/ack_delay.go +26 -0
  910. package/bin/go/src/vendor/golang.org/x/net/quic/acks.go +213 -0
  911. package/bin/go/src/vendor/golang.org/x/net/quic/atomic_bits.go +31 -0
  912. package/bin/go/src/vendor/golang.org/x/net/quic/config.go +158 -0
  913. package/bin/go/src/vendor/golang.org/x/net/quic/congestion_reno.go +306 -0
  914. package/bin/go/src/vendor/golang.org/x/net/quic/conn.go +434 -0
  915. package/bin/go/src/vendor/golang.org/x/net/quic/conn_close.go +340 -0
  916. package/bin/go/src/vendor/golang.org/x/net/quic/conn_flow.go +142 -0
  917. package/bin/go/src/vendor/golang.org/x/net/quic/conn_id.go +502 -0
  918. package/bin/go/src/vendor/golang.org/x/net/quic/conn_loss.go +85 -0
  919. package/bin/go/src/vendor/golang.org/x/net/quic/conn_recv.go +631 -0
  920. package/bin/go/src/vendor/golang.org/x/net/quic/conn_send.go +407 -0
  921. package/bin/go/src/vendor/golang.org/x/net/quic/conn_streams.go +483 -0
  922. package/bin/go/src/vendor/golang.org/x/net/quic/crypto_stream.go +157 -0
  923. package/bin/go/src/vendor/golang.org/x/net/quic/dgram.go +53 -0
  924. package/bin/go/src/vendor/golang.org/x/net/quic/doc.go +50 -0
  925. package/bin/go/src/vendor/golang.org/x/net/quic/endpoint.go +478 -0
  926. package/bin/go/src/vendor/golang.org/x/net/quic/errors.go +129 -0
  927. package/bin/go/src/vendor/golang.org/x/net/quic/frame_debug.go +730 -0
  928. package/bin/go/src/vendor/golang.org/x/net/quic/gate.go +86 -0
  929. package/bin/go/src/vendor/golang.org/x/net/quic/idle.go +168 -0
  930. package/bin/go/src/vendor/golang.org/x/net/quic/log.go +67 -0
  931. package/bin/go/src/vendor/golang.org/x/net/quic/loss.go +521 -0
  932. package/bin/go/src/{runtime/cgo/gcc_stack_windows.c → vendor/golang.org/x/net/quic/math.go} +7 -2
  933. package/bin/go/src/vendor/golang.org/x/net/quic/pacer.go +129 -0
  934. package/bin/go/src/vendor/golang.org/x/net/quic/packet.go +267 -0
  935. package/bin/go/src/vendor/golang.org/x/net/quic/packet_number.go +72 -0
  936. package/bin/go/src/vendor/golang.org/x/net/quic/packet_parser.go +519 -0
  937. package/bin/go/src/vendor/golang.org/x/net/quic/packet_protection.go +539 -0
  938. package/bin/go/src/vendor/golang.org/x/net/quic/packet_writer.go +566 -0
  939. package/bin/go/src/vendor/golang.org/x/net/quic/path.go +87 -0
  940. package/bin/go/src/vendor/golang.org/x/net/quic/ping.go +14 -0
  941. package/bin/go/src/vendor/golang.org/x/net/quic/pipe.go +173 -0
  942. package/bin/go/src/vendor/golang.org/x/net/quic/qlog.go +272 -0
  943. package/bin/go/src/vendor/golang.org/x/net/quic/queue.go +63 -0
  944. package/bin/go/src/vendor/golang.org/x/net/quic/quic.go +221 -0
  945. package/bin/go/src/vendor/golang.org/x/net/quic/race_disabled.go +10 -0
  946. package/bin/go/src/vendor/golang.org/x/net/quic/race_enabled.go +27 -0
  947. package/bin/go/src/vendor/golang.org/x/net/quic/rangeset.go +193 -0
  948. package/bin/go/src/vendor/golang.org/x/net/quic/retry.go +240 -0
  949. package/bin/go/src/vendor/golang.org/x/net/quic/rtt.go +71 -0
  950. package/bin/go/src/vendor/golang.org/x/net/quic/sent_packet.go +119 -0
  951. package/bin/go/src/vendor/golang.org/x/net/quic/sent_packet_list.go +93 -0
  952. package/bin/go/src/vendor/golang.org/x/net/quic/sent_val.go +103 -0
  953. package/bin/go/src/vendor/golang.org/x/net/quic/skip.go +62 -0
  954. package/bin/go/src/vendor/golang.org/x/net/quic/stateless_reset.go +59 -0
  955. package/bin/go/src/vendor/golang.org/x/net/quic/stream.go +1106 -0
  956. package/bin/go/src/vendor/golang.org/x/net/quic/stream_limits.go +138 -0
  957. package/bin/go/src/vendor/golang.org/x/net/quic/tls.go +123 -0
  958. package/bin/go/src/vendor/golang.org/x/net/quic/transport_params.go +283 -0
  959. package/bin/go/src/vendor/golang.org/x/net/quic/udp.go +28 -0
  960. package/bin/go/src/vendor/golang.org/x/net/quic/udp_darwin.go +45 -0
  961. package/bin/go/src/vendor/golang.org/x/net/quic/udp_linux.go +39 -0
  962. package/bin/go/src/vendor/golang.org/x/net/quic/udp_msg.go +245 -0
  963. package/bin/go/src/vendor/golang.org/x/net/quic/udp_other.go +62 -0
  964. package/bin/go/src/vendor/golang.org/x/net/quic/udp_packetconn.go +67 -0
  965. package/bin/go/src/vendor/golang.org/x/sys/cpu/asm_darwin_arm64_gc.s +12 -0
  966. package/bin/go/src/vendor/golang.org/x/sys/cpu/cpu.go +12 -7
  967. package/bin/go/src/vendor/golang.org/x/sys/cpu/cpu_arm64.go +3 -6
  968. package/bin/go/src/vendor/golang.org/x/sys/cpu/cpu_darwin_arm64.go +67 -0
  969. package/bin/go/src/vendor/golang.org/x/sys/cpu/cpu_darwin_arm64_other.go +31 -0
  970. package/bin/go/src/vendor/golang.org/x/sys/cpu/cpu_gccgo_arm64.go +1 -0
  971. package/bin/go/src/vendor/golang.org/x/sys/cpu/cpu_linux_riscv64.go +2 -0
  972. package/bin/go/src/vendor/golang.org/x/sys/cpu/cpu_loong64.go +14 -2
  973. package/bin/go/src/vendor/golang.org/x/sys/cpu/cpu_other_arm64.go +4 -2
  974. package/bin/go/src/vendor/golang.org/x/sys/cpu/cpu_riscv64.go +1 -0
  975. package/bin/go/src/vendor/golang.org/x/sys/cpu/cpu_windows.go +26 -0
  976. package/bin/go/src/vendor/golang.org/x/sys/cpu/cpu_windows_arm64.go +38 -0
  977. package/bin/go/src/vendor/golang.org/x/sys/cpu/cpu_x86.go +124 -50
  978. package/bin/go/src/vendor/golang.org/x/sys/cpu/syscall_darwin_arm64_gc.go +54 -0
  979. package/bin/go/src/vendor/golang.org/x/sys/cpu/zcpu_windows.go +48 -0
  980. package/bin/go/src/vendor/golang.org/x/text/secure/bidirule/bidirule.go +4 -0
  981. package/bin/go/src/vendor/golang.org/x/text/unicode/bidi/tables15.0.0.go +1 -1
  982. package/bin/go/src/vendor/golang.org/x/text/unicode/bidi/tables17.0.0.go +2135 -0
  983. package/bin/go/src/vendor/golang.org/x/text/unicode/norm/forminfo.go +18 -8
  984. package/bin/go/src/vendor/golang.org/x/text/unicode/norm/tables15.0.0.go +1410 -1410
  985. package/bin/go/src/vendor/golang.org/x/text/unicode/norm/{tables13.0.0.go → tables17.0.0.go} +3530 -3186
  986. package/bin/go/src/vendor/modules.txt +14 -8
  987. package/bin/ttsc-cache.exe +0 -0
  988. package/bin/ttsc.exe +0 -0
  989. package/bin/ttscserver.exe +0 -0
  990. package/package.json +1 -1
  991. package/bin/go/src/crypto/internal/fips140/nistec/p256_ordinv_noasm.go +0 -13
  992. package/bin/go/src/go/internal/scannerhooks/hooks.go +0 -11
  993. package/bin/go/src/hash/maphash/maphash_purego.go +0 -200
  994. package/bin/go/src/hash/maphash/maphash_runtime.go +0 -64
  995. package/bin/go/src/internal/goexperiment/exp_goroutineleakprofile_off.go +0 -8
  996. package/bin/go/src/internal/goexperiment/exp_goroutineleakprofile_on.go +0 -8
  997. package/bin/go/src/internal/strconv/atofeisel.go +0 -166
  998. package/bin/go/src/internal/strconv/ftoadbox.go +0 -349
  999. package/bin/go/src/internal/strconv/ftoafixed.go +0 -184
  1000. package/bin/go/src/internal/strconv/math.go +0 -179
  1001. package/bin/go/src/net/http/h2_bundle.go +0 -12371
  1002. package/bin/go/src/net/http/h2_error.go +0 -37
  1003. package/bin/go/src/runtime/cgo/gcc_darwin_amd64.c +0 -61
  1004. package/bin/go/src/runtime/cgo/gcc_darwin_arm64.c +0 -148
  1005. package/bin/go/src/runtime/cgo/gcc_dragonfly_amd64.c +0 -61
  1006. package/bin/go/src/runtime/cgo/gcc_freebsd.c +0 -72
  1007. package/bin/go/src/runtime/cgo/gcc_freebsd_amd64.c +0 -72
  1008. package/bin/go/src/runtime/cgo/gcc_linux.c +0 -67
  1009. package/bin/go/src/runtime/cgo/gcc_linux_amd64.c +0 -92
  1010. package/bin/go/src/runtime/cgo/gcc_linux_arm64.c +0 -88
  1011. package/bin/go/src/runtime/cgo/gcc_linux_s390x.c +0 -64
  1012. package/bin/go/src/runtime/cgo/gcc_openbsd.c +0 -62
  1013. package/bin/go/src/runtime/cgo/gcc_ppc64x.c +0 -68
  1014. package/bin/go/src/runtime/cgo/gcc_signal2_ios_arm64.c +0 -11
  1015. package/bin/go/src/runtime/cgo/gcc_signal_ios_arm64.c +0 -213
  1016. package/bin/go/src/runtime/cgo/gcc_signal_ios_nolldb.c +0 -10
  1017. package/bin/go/src/runtime/cgo/gcc_solaris_amd64.c +0 -83
  1018. package/bin/go/src/runtime/cgo/gcc_stack_darwin.c +0 -25
  1019. package/bin/go/src/runtime/cgo/gcc_stack_unix.c +0 -48
  1020. package/bin/go/src/runtime/cgo/gcc_windows_386.c +0 -55
  1021. package/bin/go/src/runtime/cgo/gcc_windows_amd64.c +0 -54
  1022. package/bin/go/src/runtime/cgo/gcc_windows_arm64.c +0 -42
  1023. package/bin/go/src/runtime/cgo/libcgo_windows.h +0 -6
  1024. package/bin/go/src/runtime/cgo/signal_ios_arm64.go +0 -10
  1025. package/bin/go/src/runtime/cgo/signal_ios_arm64.s +0 -56
  1026. package/bin/go/src/runtime/rt0_linux_ppc64.s +0 -28
  1027. package/bin/go/src/runtime/stubs_ppc64.go +0 -12
  1028. package/bin/go/src/simd/archsimd/_gen/simdgen/go.yaml +0 -1
  1029. package/bin/go/src/simd/archsimd/_gen/simdgen/ops/ShiftRotate/go.yaml +0 -172
  1030. package/bin/go/src/syscall/asm_openbsd_mips64.s +0 -129
  1031. package/bin/go/src/syscall/syscall_openbsd1.go +0 -12
  1032. package/bin/go/src/syscall/syscall_openbsd_libc.go +0 -84
  1033. package/bin/go/src/syscall/syscall_openbsd_mips64.go +0 -43
  1034. package/bin/go/src/syscall/zerrors_openbsd_mips64.go +0 -1682
  1035. package/bin/go/src/syscall/zsyscall_openbsd_mips64.go +0 -1289
  1036. package/bin/go/src/syscall/zsysnum_openbsd_mips64.go +0 -218
  1037. package/bin/go/src/syscall/ztypes_openbsd_mips64.go +0 -443
  1038. package/bin/go/src/vendor/golang.org/x/net/idna/go118.go +0 -13
  1039. package/bin/go/src/vendor/golang.org/x/net/idna/idna9.0.0.go +0 -717
  1040. package/bin/go/src/vendor/golang.org/x/net/idna/pre_go118.go +0 -11
  1041. package/bin/go/src/vendor/golang.org/x/net/idna/tables10.0.0.go +0 -4559
  1042. package/bin/go/src/vendor/golang.org/x/net/idna/tables11.0.0.go +0 -4653
  1043. package/bin/go/src/vendor/golang.org/x/net/idna/tables12.0.0.go +0 -4733
  1044. package/bin/go/src/vendor/golang.org/x/net/idna/tables13.0.0.go +0 -4959
  1045. package/bin/go/src/vendor/golang.org/x/net/idna/tables9.0.0.go +0 -4486
  1046. package/bin/go/src/vendor/golang.org/x/net/idna/trie12.0.0.go +0 -30
  1047. package/bin/go/src/vendor/golang.org/x/net/idna/trie13.0.0.go +0 -30
  1048. package/bin/go/src/vendor/golang.org/x/text/secure/bidirule/bidirule10.0.0.go +0 -11
  1049. package/bin/go/src/vendor/golang.org/x/text/secure/bidirule/bidirule9.0.0.go +0 -14
  1050. package/bin/go/src/vendor/golang.org/x/text/unicode/bidi/tables10.0.0.go +0 -1815
  1051. package/bin/go/src/vendor/golang.org/x/text/unicode/bidi/tables11.0.0.go +0 -1887
  1052. package/bin/go/src/vendor/golang.org/x/text/unicode/bidi/tables12.0.0.go +0 -1923
  1053. package/bin/go/src/vendor/golang.org/x/text/unicode/bidi/tables13.0.0.go +0 -1955
  1054. package/bin/go/src/vendor/golang.org/x/text/unicode/bidi/tables9.0.0.go +0 -1781
  1055. package/bin/go/src/vendor/golang.org/x/text/unicode/norm/tables10.0.0.go +0 -7657
  1056. package/bin/go/src/vendor/golang.org/x/text/unicode/norm/tables11.0.0.go +0 -7693
  1057. package/bin/go/src/vendor/golang.org/x/text/unicode/norm/tables12.0.0.go +0 -7710
  1058. package/bin/go/src/vendor/golang.org/x/text/unicode/norm/tables9.0.0.go +0 -7637
  1059. /package/bin/go/src/simd/archsimd/_gen/simdgen/ops/BitwiseLogic/{go.yaml → go_amd64.yaml} +0 -0
  1060. /package/bin/go/src/simd/archsimd/_gen/simdgen/ops/Compares/{go.yaml → go_amd64.yaml} +0 -0
  1061. /package/bin/go/src/simd/archsimd/_gen/simdgen/ops/MinMax/{go.yaml → go_amd64.yaml} +0 -0
  1062. /package/bin/go/src/simd/archsimd/_gen/simdgen/ops/Others/{go.yaml → go_amd64.yaml} +0 -0
@@ -0,0 +1,3275 @@
1
+ // Copyright 2026 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
+
5
+ //go:build goexperiment.simd && (amd64 || wasm || arm64)
6
+
7
+ package bridge
8
+
9
+ import (
10
+ "internal/strconv"
11
+ "math"
12
+ "math/bits"
13
+ )
14
+
15
+ // VectorSize returns the bit length of the emulated vector (fixed to 128).
16
+ func VectorBitSize() int {
17
+ return 128
18
+ }
19
+
20
+ // Emulated returns whether simd is emulated.
21
+ func Emulated() bool {
22
+ return true
23
+ }
24
+
25
+ // HasHardwareCarrylessMultiply returns whether this platform
26
+ // has a hardware-implemented version of carryless multiply.
27
+ // With default GODEBUG=simd settings, if this is false,
28
+ // it is emulated and merely slow, but with non-default settings
29
+ // this can indicate the possibility of a missing instruction
30
+ // that will fail ("SIGILL") if it is executed.
31
+ func HasHardwareCarrylessMultiply() bool {
32
+ return false
33
+ }
34
+
35
+ type number interface {
36
+ ~int8 | ~int16 | ~int32 | ~int64 | ~uint8 | ~uint16 | ~uint32 | ~uint64 | ~float32 | ~float64
37
+ }
38
+
39
+ func sliceToString[T number](x []T) string {
40
+ s := ""
41
+ pfx := "{"
42
+ for _, y := range x {
43
+ s += pfx
44
+ pfx = ","
45
+ switch e := any(y).(type) {
46
+ case int8:
47
+ s += strconv.Itoa(int(e))
48
+ case int16:
49
+ s += strconv.Itoa(int(e))
50
+ case int32:
51
+ s += strconv.Itoa(int(e))
52
+ case int64:
53
+ s += strconv.FormatInt(int64(e), 10)
54
+ case uint8:
55
+ s += strconv.FormatUint(uint64(e), 10)
56
+ case uint16:
57
+ s += strconv.FormatUint(uint64(e), 10)
58
+ case uint32:
59
+ s += strconv.FormatUint(uint64(e), 10)
60
+ case uint64:
61
+ s += strconv.FormatUint(uint64(e), 10)
62
+ case float32:
63
+ s += strconv.FormatFloat(float64(e), 'g', -1, 32)
64
+ case float64:
65
+ s += strconv.FormatFloat(e, 'g', -1, 64)
66
+ }
67
+ }
68
+ s += "}"
69
+ return s
70
+ }
71
+
72
+ // LoadInt8s loads a slice of int8 into an Int8s vector.
73
+ func LoadInt8s(s []int8) Int8s {
74
+ var a, b uint64
75
+ for i := 0; i < 16; i++ {
76
+ val := uint64(uint8(s[i]))
77
+ if i < 8 {
78
+ a |= val << (8 * i)
79
+ } else {
80
+ b |= val << (8 * (i - 8))
81
+ }
82
+ }
83
+ return Int8s{a: a, b: b}
84
+ }
85
+
86
+ // LoadInt8sPart loads a partial slice of int8 into an Int8s vector.
87
+ func LoadInt8sPart(s []int8) (Int8s, int) {
88
+ var a, b uint64
89
+ n := len(s)
90
+ if n > 16 {
91
+ n = 16
92
+ }
93
+ for i := 0; i < n; i++ {
94
+ val := uint64(uint8(s[i]))
95
+ if i < 8 {
96
+ a |= val << (8 * i)
97
+ } else {
98
+ b |= val << (8 * (i - 8))
99
+ }
100
+ }
101
+ return Int8s{a: a, b: b}, n
102
+ }
103
+
104
+ func (x Int8s) get(i int) int8 {
105
+ if i < 8 {
106
+ return int8(x.a >> (8 * i))
107
+ }
108
+ return int8(x.b >> (8 * (i - 8)))
109
+ }
110
+
111
+ func (x *Int8s) set(i int, v int8) {
112
+ val := uint64(uint8(v))
113
+ if i < 8 {
114
+ mask := uint64(0xff) << (8 * i)
115
+ x.a = (x.a &^ mask) | (val << (8 * i))
116
+ } else {
117
+ mask := uint64(0xff) << (8 * (i - 8))
118
+ x.b = (x.b &^ mask) | (val << (8 * (i - 8)))
119
+ }
120
+ }
121
+
122
+ // Abs returns the element-wise absolute value of x.
123
+ func (x Int8s) Abs() Int8s {
124
+ var res Int8s
125
+ for i := 0; i < 16; i++ {
126
+ v := x.get(i)
127
+ if v < 0 {
128
+ res.set(i, -v)
129
+ } else {
130
+ res.set(i, v)
131
+ }
132
+ }
133
+ return res
134
+ }
135
+
136
+ // Add returns the element-wise sum of x and y.
137
+ func (x Int8s) Add(y Int8s) Int8s {
138
+ var res Int8s
139
+ for i := 0; i < 16; i++ {
140
+ res.set(i, x.get(i)+y.get(i))
141
+ }
142
+ return res
143
+ }
144
+
145
+ // AddSaturated returns the element-wise saturated sum of x and y.
146
+ func (x Int8s) AddSaturated(y Int8s) Int8s {
147
+ var res Int8s
148
+ for i := 0; i < 16; i++ {
149
+ sum := int(x.get(i)) + int(y.get(i))
150
+ if sum > math.MaxInt8 {
151
+ res.set(i, math.MaxInt8)
152
+ } else if sum < math.MinInt8 {
153
+ res.set(i, math.MinInt8)
154
+ } else {
155
+ res.set(i, int8(sum))
156
+ }
157
+ }
158
+ return res
159
+ }
160
+
161
+ // And returns the bitwise AND of x and y.
162
+ func (x Int8s) And(y Int8s) Int8s {
163
+ return Int8s{a: x.a & y.a, b: x.b & y.b}
164
+ }
165
+
166
+ // AndNot returns the bitwise AND NOT of x and y.
167
+ func (x Int8s) AndNot(y Int8s) Int8s {
168
+ return Int8s{a: x.a &^ y.a, b: x.b &^ y.b}
169
+ }
170
+
171
+ // Equal returns a mask indicating where x and y are equal.
172
+ func (x Int8s) Equal(y Int8s) Mask8s {
173
+ var res Mask8s
174
+ for i := 0; i < 16; i++ {
175
+ if x.get(i) == y.get(i) {
176
+ res.set(i, true)
177
+ }
178
+ }
179
+ return res
180
+ }
181
+
182
+ // Greater returns a mask indicating where x is greater than y.
183
+ func (x Int8s) Greater(y Int8s) Mask8s {
184
+ var res Mask8s
185
+ for i := 0; i < 16; i++ {
186
+ if x.get(i) > y.get(i) {
187
+ res.set(i, true)
188
+ }
189
+ }
190
+ return res
191
+ }
192
+
193
+ // GreaterEqual returns a mask indicating where x is greater than or equal to y.
194
+ func (x Int8s) GreaterEqual(y Int8s) Mask8s {
195
+ var res Mask8s
196
+ for i := 0; i < 16; i++ {
197
+ if x.get(i) >= y.get(i) {
198
+ res.set(i, true)
199
+ }
200
+ }
201
+ return res
202
+ }
203
+
204
+ // Less returns a mask indicating where x is less than y.
205
+ func (x Int8s) Less(y Int8s) Mask8s {
206
+ var res Mask8s
207
+ for i := 0; i < 16; i++ {
208
+ if x.get(i) < y.get(i) {
209
+ res.set(i, true)
210
+ }
211
+ }
212
+ return res
213
+ }
214
+
215
+ // LessEqual returns a mask indicating where x is less than or equal to y.
216
+ func (x Int8s) LessEqual(y Int8s) Mask8s {
217
+ var res Mask8s
218
+ for i := 0; i < 16; i++ {
219
+ if x.get(i) <= y.get(i) {
220
+ res.set(i, true)
221
+ }
222
+ }
223
+ return res
224
+ }
225
+
226
+ // NotEqual returns a mask indicating where x and y are not equal.
227
+ func (x Int8s) NotEqual(y Int8s) Mask8s {
228
+ var res Mask8s
229
+ for i := 0; i < 16; i++ {
230
+ if x.get(i) != y.get(i) {
231
+ res.set(i, true)
232
+ }
233
+ }
234
+ return res
235
+ }
236
+
237
+ // Len returns the number of elements in the vector.
238
+ func (x Int8s) Len() int {
239
+ return 16
240
+ }
241
+
242
+ // Masked returns a new vector with elements from x where mask is true, and zero elsewhere.
243
+ func (x Int8s) Masked(mask Mask8s) Int8s {
244
+ return Int8s{a: x.a & mask.a, b: x.b & mask.b}
245
+ }
246
+
247
+ // Max returns the element-wise maximum of x and y.
248
+ func (x Int8s) Max(y Int8s) Int8s {
249
+ var res Int8s
250
+ for i := 0; i < 16; i++ {
251
+ vx := x.get(i)
252
+ vy := y.get(i)
253
+ if vx > vy {
254
+ res.set(i, vx)
255
+ } else {
256
+ res.set(i, vy)
257
+ }
258
+ }
259
+ return res
260
+ }
261
+
262
+ // Mul returns the element-wise product of x and y.
263
+ func (x Int8s) Mul(y Int8s) Int8s {
264
+ var res Int8s
265
+ for i := 0; i < 16; i++ {
266
+ res.set(i, x.get(i)*y.get(i))
267
+ }
268
+ return res
269
+ }
270
+
271
+ // IfElse returns a new vector with elements from x where mask is true, and y where mask is false.
272
+ func (x Int8s) IfElse(mask Mask8s, y Int8s) Int8s {
273
+ return Int8s{
274
+ a: (x.a & mask.a) | (y.a &^ mask.a),
275
+ b: (x.b & mask.b) | (y.b &^ mask.b),
276
+ }
277
+ }
278
+
279
+ // Min returns the element-wise minimum of x and y.
280
+ func (x Int8s) Min(y Int8s) Int8s {
281
+ var res Int8s
282
+ for i := 0; i < 16; i++ {
283
+ vx := x.get(i)
284
+ vy := y.get(i)
285
+ if vx < vy {
286
+ res.set(i, vx)
287
+ } else {
288
+ res.set(i, vy)
289
+ }
290
+ }
291
+ return res
292
+ }
293
+
294
+ // Neg returns the element-wise negation of x.
295
+ func (x Int8s) Neg() Int8s {
296
+ var res Int8s
297
+ for i := 0; i < 16; i++ {
298
+ res.set(i, -x.get(i))
299
+ }
300
+ return res
301
+ }
302
+
303
+ // Not returns the bitwise NOT of x.
304
+ func (x Int8s) Not() Int8s {
305
+ return Int8s{a: ^x.a, b: ^x.b}
306
+ }
307
+
308
+ // Or returns the bitwise OR of x and y.
309
+ func (x Int8s) Or(y Int8s) Int8s {
310
+ return Int8s{a: x.a | y.a, b: x.b | y.b}
311
+ }
312
+
313
+ // Store stores the vector elements into the slice s.
314
+ func (x Int8s) Store(s []int8) {
315
+ for i := 0; i < 16 && i < len(s); i++ {
316
+ s[i] = x.get(i)
317
+ }
318
+ }
319
+
320
+ // StorePart stores a partial vector into the slice s.
321
+ func (x Int8s) StorePart(s []int8) int {
322
+ x.Store(s)
323
+ return min(len(s), x.Len())
324
+ }
325
+
326
+ // String returns a string representation of the vector.
327
+ func (x Int8s) String() string {
328
+ var parts [16]int8
329
+ for i := 0; i < 16; i++ {
330
+ parts[i] = x.get(i)
331
+ }
332
+ return sliceToString(parts[:])
333
+ }
334
+
335
+ // Sub returns the element-wise difference of x and y.
336
+ func (x Int8s) Sub(y Int8s) Int8s {
337
+ var res Int8s
338
+ for i := 0; i < 16; i++ {
339
+ res.set(i, x.get(i)-y.get(i))
340
+ }
341
+ return res
342
+ }
343
+
344
+ // SubSaturated returns the element-wise saturated difference of x and y.
345
+ func (x Int8s) SubSaturated(y Int8s) Int8s {
346
+ var res Int8s
347
+ for i := 0; i < 16; i++ {
348
+ diff := int(x.get(i)) - int(y.get(i))
349
+ if diff > math.MaxInt8 {
350
+ res.set(i, math.MaxInt8)
351
+ } else if diff < math.MinInt8 {
352
+ res.set(i, math.MinInt8)
353
+ } else {
354
+ res.set(i, int8(diff))
355
+ }
356
+ }
357
+ return res
358
+ }
359
+
360
+ // ToMask returns a mask representation of the vector.
361
+ func (x Int8s) ToMask() Mask8s {
362
+ var res Mask8s
363
+ for i := 0; i < 16; i++ {
364
+ if x.get(i) != 0 {
365
+ res.set(i, true)
366
+ }
367
+ }
368
+ return res
369
+ }
370
+
371
+ // Xor returns the bitwise XOR of x and y.
372
+ func (x Int8s) Xor(y Int8s) Int8s {
373
+ return Int8s{a: x.a ^ y.a, b: x.b ^ y.b}
374
+ }
375
+
376
+ // ConvertToUint8 converts the vector elements to uint8.
377
+ func (x Int8s) ConvertToUint8() Uint8s {
378
+ return Uint8s{a: x.a, b: x.b}
379
+ }
380
+
381
+ // ToBits reinterprets the vector bits as a Uint8s vector.
382
+ func (x Int8s) ToBits() Uint8s {
383
+ return Uint8s{a: x.a, b: x.b}
384
+ }
385
+
386
+ // LoadInt16s loads a slice of int16 into an Int16s vector.
387
+ func LoadInt16s(s []int16) Int16s {
388
+ var a, b uint64
389
+ for i := 0; i < 8; i++ {
390
+ val := uint64(uint16(s[i]))
391
+ if i < 4 {
392
+ a |= val << (16 * i)
393
+ } else {
394
+ b |= val << (16 * (i - 4))
395
+ }
396
+ }
397
+ return Int16s{a: a, b: b}
398
+ }
399
+
400
+ // LoadInt16sPart loads a partial slice of int16 into an Int16s vector.
401
+ func LoadInt16sPart(s []int16) (Int16s, int) {
402
+ var a, b uint64
403
+ n := len(s)
404
+ if n > 8 {
405
+ n = 8
406
+ }
407
+ for i := 0; i < n; i++ {
408
+ val := uint64(uint16(s[i]))
409
+ if i < 4 {
410
+ a |= val << (16 * i)
411
+ } else {
412
+ b |= val << (16 * (i - 4))
413
+ }
414
+ }
415
+ return Int16s{a: a, b: b}, n
416
+ }
417
+
418
+ func (x Int16s) get(i int) int16 {
419
+ if i < 4 {
420
+ return int16(x.a >> (16 * i))
421
+ }
422
+ return int16(x.b >> (16 * (i - 4)))
423
+ }
424
+
425
+ func (x *Int16s) set(i int, v int16) {
426
+ val := uint64(uint16(v))
427
+ if i < 4 {
428
+ mask := uint64(0xffff) << (16 * i)
429
+ x.a = (x.a &^ mask) | (val << (16 * i))
430
+ } else {
431
+ mask := uint64(0xffff) << (16 * (i - 4))
432
+ x.b = (x.b &^ mask) | (val << (16 * (i - 4)))
433
+ }
434
+ }
435
+
436
+ // Abs returns the element-wise absolute value of x.
437
+ func (x Int16s) Abs() Int16s {
438
+ var res Int16s
439
+ for i := 0; i < 8; i++ {
440
+ v := x.get(i)
441
+ if v < 0 {
442
+ res.set(i, -v)
443
+ } else {
444
+ res.set(i, v)
445
+ }
446
+ }
447
+ return res
448
+ }
449
+
450
+ // Add returns the element-wise sum of x and y.
451
+ func (x Int16s) Add(y Int16s) Int16s {
452
+ var res Int16s
453
+ for i := 0; i < 8; i++ {
454
+ res.set(i, x.get(i)+y.get(i))
455
+ }
456
+ return res
457
+ }
458
+
459
+ // AddSaturated returns the element-wise saturated sum of x and y.
460
+ func (x Int16s) AddSaturated(y Int16s) Int16s {
461
+ var res Int16s
462
+ for i := 0; i < 8; i++ {
463
+ sum := int(x.get(i)) + int(y.get(i))
464
+ if sum > math.MaxInt16 {
465
+ res.set(i, math.MaxInt16)
466
+ } else if sum < math.MinInt16 {
467
+ res.set(i, math.MinInt16)
468
+ } else {
469
+ res.set(i, int16(sum))
470
+ }
471
+ }
472
+ return res
473
+ }
474
+
475
+ // And returns the bitwise AND of x and y.
476
+ func (x Int16s) And(y Int16s) Int16s {
477
+ return Int16s{a: x.a & y.a, b: x.b & y.b}
478
+ }
479
+
480
+ // AndNot returns the bitwise AND NOT of x and y.
481
+ func (x Int16s) AndNot(y Int16s) Int16s {
482
+ return Int16s{a: x.a &^ y.a, b: x.b &^ y.b}
483
+ }
484
+
485
+ // Equal returns a mask indicating where x and y are equal.
486
+ func (x Int16s) Equal(y Int16s) Mask16s {
487
+ var res Mask16s
488
+ for i := 0; i < 8; i++ {
489
+ if x.get(i) == y.get(i) {
490
+ res.set(i, true)
491
+ }
492
+ }
493
+ return res
494
+ }
495
+
496
+ // Greater returns a mask indicating where x is greater than y.
497
+ func (x Int16s) Greater(y Int16s) Mask16s {
498
+ var res Mask16s
499
+ for i := 0; i < 8; i++ {
500
+ if x.get(i) > y.get(i) {
501
+ res.set(i, true)
502
+ }
503
+ }
504
+ return res
505
+ }
506
+
507
+ // GreaterEqual returns a mask indicating where x is greater than or equal to y.
508
+ func (x Int16s) GreaterEqual(y Int16s) Mask16s {
509
+ var res Mask16s
510
+ for i := 0; i < 8; i++ {
511
+ if x.get(i) >= y.get(i) {
512
+ res.set(i, true)
513
+ }
514
+ }
515
+ return res
516
+ }
517
+
518
+ // Less returns a mask indicating where x is less than y.
519
+ func (x Int16s) Less(y Int16s) Mask16s {
520
+ var res Mask16s
521
+ for i := 0; i < 8; i++ {
522
+ if x.get(i) < y.get(i) {
523
+ res.set(i, true)
524
+ }
525
+ }
526
+ return res
527
+ }
528
+
529
+ // LessEqual returns a mask indicating where x is less than or equal to y.
530
+ func (x Int16s) LessEqual(y Int16s) Mask16s {
531
+ var res Mask16s
532
+ for i := 0; i < 8; i++ {
533
+ if x.get(i) <= y.get(i) {
534
+ res.set(i, true)
535
+ }
536
+ }
537
+ return res
538
+ }
539
+
540
+ // NotEqual returns a mask indicating where x and y are not equal.
541
+ func (x Int16s) NotEqual(y Int16s) Mask16s {
542
+ var res Mask16s
543
+ for i := 0; i < 8; i++ {
544
+ if x.get(i) != y.get(i) {
545
+ res.set(i, true)
546
+ }
547
+ }
548
+ return res
549
+ }
550
+
551
+ // Len returns the number of elements in the vector.
552
+ func (x Int16s) Len() int {
553
+ return 8
554
+ }
555
+
556
+ // Masked returns a new vector with elements from x where mask is true, and zero elsewhere.
557
+ func (x Int16s) Masked(mask Mask16s) Int16s {
558
+ return Int16s{a: x.a & mask.a, b: x.b & mask.b}
559
+ }
560
+
561
+ // Max returns the element-wise maximum of x and y.
562
+ func (x Int16s) Max(y Int16s) Int16s {
563
+ var res Int16s
564
+ for i := 0; i < 8; i++ {
565
+ vx := x.get(i)
566
+ vy := y.get(i)
567
+ if vx > vy {
568
+ res.set(i, vx)
569
+ } else {
570
+ res.set(i, vy)
571
+ }
572
+ }
573
+ return res
574
+ }
575
+
576
+ // IfElse returns a new vector with elements from x where mask is true, and y where mask is false.
577
+ func (x Int16s) IfElse(mask Mask16s, y Int16s) Int16s {
578
+ return Int16s{
579
+ a: (x.a & mask.a) | (y.a &^ mask.a),
580
+ b: (x.b & mask.b) | (y.b &^ mask.b),
581
+ }
582
+ }
583
+
584
+ // Min returns the element-wise minimum of x and y.
585
+ func (x Int16s) Min(y Int16s) Int16s {
586
+ var res Int16s
587
+ for i := 0; i < 8; i++ {
588
+ vx := x.get(i)
589
+ vy := y.get(i)
590
+ if vx < vy {
591
+ res.set(i, vx)
592
+ } else {
593
+ res.set(i, vy)
594
+ }
595
+ }
596
+ return res
597
+ }
598
+
599
+ // Mul returns the element-wise product of x and y.
600
+ func (x Int16s) Mul(y Int16s) Int16s {
601
+ var res Int16s
602
+ for i := 0; i < 8; i++ {
603
+ res.set(i, x.get(i)*y.get(i))
604
+ }
605
+ return res
606
+ }
607
+
608
+ // Neg returns the element-wise negation of x.
609
+ func (x Int16s) Neg() Int16s {
610
+ var res Int16s
611
+ for i := 0; i < 8; i++ {
612
+ res.set(i, -x.get(i))
613
+ }
614
+ return res
615
+ }
616
+
617
+ // Not returns the bitwise NOT of x.
618
+ func (x Int16s) Not() Int16s {
619
+ return Int16s{a: ^x.a, b: ^x.b}
620
+ }
621
+
622
+ // Or returns the bitwise OR of x and y.
623
+ func (x Int16s) Or(y Int16s) Int16s {
624
+ return Int16s{a: x.a | y.a, b: x.b | y.b}
625
+ }
626
+
627
+ // ShiftAllLeft shifts all elements left by y bits.
628
+ func (x Int16s) ShiftAllLeft(y uint64) Int16s {
629
+ var res Int16s
630
+ for i := 0; i < 8; i++ {
631
+ res.set(i, x.get(i)<<y)
632
+ }
633
+ return res
634
+ }
635
+
636
+ // ShiftAllRight shifts all elements right by y bits.
637
+ func (x Int16s) ShiftAllRight(y uint64) Int16s {
638
+ var res Int16s
639
+ for i := 0; i < 8; i++ {
640
+ res.set(i, x.get(i)>>y)
641
+ }
642
+ return res
643
+ }
644
+
645
+ // RotateAllLeft rotates all elements left by dist bits.
646
+ func (x Int16s) RotateAllLeft(dist uint64) Int16s {
647
+ var res Int16s
648
+ d := dist & 15
649
+ for i := 0; i < 8; i++ {
650
+ u := uint16(x.get(i))
651
+ r := (u << d) | (u >> ((16 - d) & 15))
652
+ res.set(i, int16(r))
653
+ }
654
+ return res
655
+ }
656
+
657
+ // RotateAllRight rotates all elements right by dist bits.
658
+ func (x Int16s) RotateAllRight(dist uint64) Int16s {
659
+ var res Int16s
660
+ d := dist & 15
661
+ for i := 0; i < 8; i++ {
662
+ u := uint16(x.get(i))
663
+ r := (u >> d) | (u << ((16 - d) & 15))
664
+ res.set(i, int16(r))
665
+ }
666
+ return res
667
+ }
668
+
669
+ // Store stores the vector elements into the slice s.
670
+ func (x Int16s) Store(s []int16) {
671
+ for i := 0; i < 8 && i < len(s); i++ {
672
+ s[i] = x.get(i)
673
+ }
674
+ }
675
+
676
+ // StorePart stores a partial vector into the slice s.
677
+ func (x Int16s) StorePart(s []int16) int {
678
+ x.Store(s)
679
+ return min(len(s), x.Len())
680
+ }
681
+
682
+ // String returns a string representation of the vector.
683
+ func (x Int16s) String() string {
684
+ var parts [8]int16
685
+ for i := 0; i < 8; i++ {
686
+ parts[i] = x.get(i)
687
+ }
688
+ return sliceToString(parts[:])
689
+ }
690
+
691
+ // Sub returns the element-wise difference of x and y.
692
+ func (x Int16s) Sub(y Int16s) Int16s {
693
+ var res Int16s
694
+ for i := 0; i < 8; i++ {
695
+ res.set(i, x.get(i)-y.get(i))
696
+ }
697
+ return res
698
+ }
699
+
700
+ // SubSaturated returns the element-wise saturated difference of x and y.
701
+ func (x Int16s) SubSaturated(y Int16s) Int16s {
702
+ var res Int16s
703
+ for i := 0; i < 8; i++ {
704
+ diff := int(x.get(i)) - int(y.get(i))
705
+ if diff > math.MaxInt16 {
706
+ res.set(i, math.MaxInt16)
707
+ } else if diff < math.MinInt16 {
708
+ res.set(i, math.MinInt16)
709
+ } else {
710
+ res.set(i, int16(diff))
711
+ }
712
+ }
713
+ return res
714
+ }
715
+
716
+ // ToMask returns a mask representation of the vector.
717
+ func (x Int16s) ToMask() Mask16s {
718
+ var res Mask16s
719
+ for i := 0; i < 8; i++ {
720
+ if x.get(i) != 0 {
721
+ res.set(i, true)
722
+ }
723
+ }
724
+ return res
725
+ }
726
+
727
+ // Xor returns the bitwise XOR of x and y.
728
+ func (x Int16s) Xor(y Int16s) Int16s {
729
+ return Int16s{a: x.a ^ y.a, b: x.b ^ y.b}
730
+ }
731
+
732
+ // ConvertToUint16 converts the vector elements to uint16.
733
+ func (x Int16s) ConvertToUint16() Uint16s {
734
+ return Uint16s{a: x.a, b: x.b}
735
+ }
736
+
737
+ // ToBits reinterprets the vector bits as a Uint16s vector.
738
+ func (x Int16s) ToBits() Uint16s {
739
+ return Uint16s{a: x.a, b: x.b}
740
+ }
741
+
742
+ // LoadInt32s loads a slice of int32 into an Int32s vector.
743
+ func LoadInt32s(s []int32) Int32s {
744
+ var a, b uint64
745
+ for i := 0; i < 4; i++ {
746
+ val := uint64(uint32(s[i]))
747
+ if i < 2 {
748
+ a |= val << (32 * i)
749
+ } else {
750
+ b |= val << (32 * (i - 2))
751
+ }
752
+ }
753
+ return Int32s{a: a, b: b}
754
+ }
755
+
756
+ // LoadInt32sPart loads a partial slice of int32 into an Int32s vector.
757
+ func LoadInt32sPart(s []int32) (Int32s, int) {
758
+ var a, b uint64
759
+ n := len(s)
760
+ if n > 4 {
761
+ n = 4
762
+ }
763
+ for i := 0; i < n; i++ {
764
+ val := uint64(uint32(s[i]))
765
+ if i < 2 {
766
+ a |= val << (32 * i)
767
+ } else {
768
+ b |= val << (32 * (i - 2))
769
+ }
770
+ }
771
+ return Int32s{a: a, b: b}, n
772
+ }
773
+
774
+ func (x Int32s) get(i int) int32 {
775
+ if i < 2 {
776
+ return int32(x.a >> (32 * i))
777
+ }
778
+ return int32(x.b >> (32 * (i - 2)))
779
+ }
780
+
781
+ func (x *Int32s) set(i int, v int32) {
782
+ val := uint64(uint32(v))
783
+ if i < 2 {
784
+ mask := uint64(0xffffffff) << (32 * i)
785
+ x.a = (x.a &^ mask) | (val << (32 * i))
786
+ } else {
787
+ mask := uint64(0xffffffff) << (32 * (i - 2))
788
+ x.b = (x.b &^ mask) | (val << (32 * (i - 2)))
789
+ }
790
+ }
791
+
792
+ // Abs returns the element-wise absolute value of x.
793
+ func (x Int32s) Abs() Int32s {
794
+ var res Int32s
795
+ for i := 0; i < 4; i++ {
796
+ v := x.get(i)
797
+ if v < 0 {
798
+ res.set(i, -v)
799
+ } else {
800
+ res.set(i, v)
801
+ }
802
+ }
803
+ return res
804
+ }
805
+
806
+ // Add returns the element-wise sum of x and y.
807
+ func (x Int32s) Add(y Int32s) Int32s {
808
+ var res Int32s
809
+ for i := 0; i < 4; i++ {
810
+ res.set(i, x.get(i)+y.get(i))
811
+ }
812
+ return res
813
+ }
814
+
815
+ // And returns the bitwise AND of x and y.
816
+ func (x Int32s) And(y Int32s) Int32s {
817
+ return Int32s{a: x.a & y.a, b: x.b & y.b}
818
+ }
819
+
820
+ // AndNot returns the bitwise AND NOT of x and y.
821
+ func (x Int32s) AndNot(y Int32s) Int32s {
822
+ return Int32s{a: x.a &^ y.a, b: x.b &^ y.b}
823
+ }
824
+
825
+ // ConvertToFloat32 converts the vector elements to float32.
826
+ func (x Int32s) ConvertToFloat32() Float32s {
827
+ var res Float32s
828
+ for i := 0; i < 4; i++ {
829
+ res.set(i, float32(x.get(i)))
830
+ }
831
+ return res
832
+ }
833
+
834
+ // Equal returns a mask indicating where x and y are equal.
835
+ func (x Int32s) Equal(y Int32s) Mask32s {
836
+ var res Mask32s
837
+ for i := 0; i < 4; i++ {
838
+ if x.get(i) == y.get(i) {
839
+ res.set(i, true)
840
+ }
841
+ }
842
+ return res
843
+ }
844
+
845
+ // Greater returns a mask indicating where x is greater than y.
846
+ func (x Int32s) Greater(y Int32s) Mask32s {
847
+ var res Mask32s
848
+ for i := 0; i < 4; i++ {
849
+ if x.get(i) > y.get(i) {
850
+ res.set(i, true)
851
+ }
852
+ }
853
+ return res
854
+ }
855
+
856
+ // GreaterEqual returns a mask indicating where x is greater than or equal to y.
857
+ func (x Int32s) GreaterEqual(y Int32s) Mask32s {
858
+ var res Mask32s
859
+ for i := 0; i < 4; i++ {
860
+ if x.get(i) >= y.get(i) {
861
+ res.set(i, true)
862
+ }
863
+ }
864
+ return res
865
+ }
866
+
867
+ // Less returns a mask indicating where x is less than y.
868
+ func (x Int32s) Less(y Int32s) Mask32s {
869
+ var res Mask32s
870
+ for i := 0; i < 4; i++ {
871
+ if x.get(i) < y.get(i) {
872
+ res.set(i, true)
873
+ }
874
+ }
875
+ return res
876
+ }
877
+
878
+ // LessEqual returns a mask indicating where x is less than or equal to y.
879
+ func (x Int32s) LessEqual(y Int32s) Mask32s {
880
+ var res Mask32s
881
+ for i := 0; i < 4; i++ {
882
+ if x.get(i) <= y.get(i) {
883
+ res.set(i, true)
884
+ }
885
+ }
886
+ return res
887
+ }
888
+
889
+ // NotEqual returns a mask indicating where x and y are not equal.
890
+ func (x Int32s) NotEqual(y Int32s) Mask32s {
891
+ var res Mask32s
892
+ for i := 0; i < 4; i++ {
893
+ if x.get(i) != y.get(i) {
894
+ res.set(i, true)
895
+ }
896
+ }
897
+ return res
898
+ }
899
+
900
+ // Len returns the number of elements in the vector.
901
+ func (x Int32s) Len() int {
902
+ return 4
903
+ }
904
+
905
+ // Masked returns a new vector with elements from x where mask is true, and zero elsewhere.
906
+ func (x Int32s) Masked(mask Mask32s) Int32s {
907
+ return Int32s{a: x.a & mask.a, b: x.b & mask.b}
908
+ }
909
+
910
+ // Max returns the element-wise maximum of x and y.
911
+ func (x Int32s) Max(y Int32s) Int32s {
912
+ var res Int32s
913
+ for i := 0; i < 4; i++ {
914
+ vx := x.get(i)
915
+ vy := y.get(i)
916
+ if vx > vy {
917
+ res.set(i, vx)
918
+ } else {
919
+ res.set(i, vy)
920
+ }
921
+ }
922
+ return res
923
+ }
924
+
925
+ // IfElse returns a new vector with elements from x where mask is true, and y where mask is false.
926
+ func (x Int32s) IfElse(mask Mask32s, y Int32s) Int32s {
927
+ return Int32s{
928
+ a: (x.a & mask.a) | (y.a &^ mask.a),
929
+ b: (x.b & mask.b) | (y.b &^ mask.b),
930
+ }
931
+ }
932
+
933
+ // Min returns the element-wise minimum of x and y.
934
+ func (x Int32s) Min(y Int32s) Int32s {
935
+ var res Int32s
936
+ for i := 0; i < 4; i++ {
937
+ vx := x.get(i)
938
+ vy := y.get(i)
939
+ if vx < vy {
940
+ res.set(i, vx)
941
+ } else {
942
+ res.set(i, vy)
943
+ }
944
+ }
945
+ return res
946
+ }
947
+
948
+ // Mul returns the element-wise product of x and y.
949
+ func (x Int32s) Mul(y Int32s) Int32s {
950
+ var res Int32s
951
+ for i := 0; i < 4; i++ {
952
+ res.set(i, x.get(i)*y.get(i))
953
+ }
954
+ return res
955
+ }
956
+
957
+ // Neg returns the element-wise negation of x.
958
+ func (x Int32s) Neg() Int32s {
959
+ var res Int32s
960
+ for i := 0; i < 4; i++ {
961
+ res.set(i, -x.get(i))
962
+ }
963
+ return res
964
+ }
965
+
966
+ // Not returns the bitwise NOT of x.
967
+ func (x Int32s) Not() Int32s {
968
+ return Int32s{a: ^x.a, b: ^x.b}
969
+ }
970
+
971
+ // Or returns the bitwise OR of x and y.
972
+ func (x Int32s) Or(y Int32s) Int32s {
973
+ return Int32s{a: x.a | y.a, b: x.b | y.b}
974
+ }
975
+
976
+ // ShiftAllLeft shifts all elements left by y bits.
977
+ func (x Int32s) ShiftAllLeft(y uint64) Int32s {
978
+ var res Int32s
979
+ for i := 0; i < 4; i++ {
980
+ res.set(i, x.get(i)<<y)
981
+ }
982
+ return res
983
+ }
984
+
985
+ // ShiftAllRight shifts all elements right by y bits.
986
+ func (x Int32s) ShiftAllRight(y uint64) Int32s {
987
+ var res Int32s
988
+ for i := 0; i < 4; i++ {
989
+ res.set(i, x.get(i)>>y)
990
+ }
991
+ return res
992
+ }
993
+
994
+ // RotateAllLeft rotates all elements left by dist bits.
995
+ func (x Int32s) RotateAllLeft(dist uint64) Int32s {
996
+ var res Int32s
997
+ d := dist & 31
998
+ for i := 0; i < 4; i++ {
999
+ u := uint32(x.get(i))
1000
+ r := (u << d) | (u >> ((32 - d) & 31))
1001
+ res.set(i, int32(r))
1002
+ }
1003
+ return res
1004
+ }
1005
+
1006
+ // RotateAllRight rotates all elements right by dist bits.
1007
+ func (x Int32s) RotateAllRight(dist uint64) Int32s {
1008
+ var res Int32s
1009
+ d := dist & 31
1010
+ for i := 0; i < 4; i++ {
1011
+ u := uint32(x.get(i))
1012
+ r := (u >> d) | (u << ((32 - d) & 31))
1013
+ res.set(i, int32(r))
1014
+ }
1015
+ return res
1016
+ }
1017
+
1018
+ // Store stores the vector elements into the slice s.
1019
+ func (x Int32s) Store(s []int32) {
1020
+ for i := 0; i < 4 && i < len(s); i++ {
1021
+ s[i] = x.get(i)
1022
+ }
1023
+ }
1024
+
1025
+ // StorePart stores a partial vector into the slice s.
1026
+ func (x Int32s) StorePart(s []int32) int {
1027
+ x.Store(s)
1028
+ return min(len(s), x.Len())
1029
+ }
1030
+
1031
+ // String returns a string representation of the vector.
1032
+ func (x Int32s) String() string {
1033
+ var parts [4]int32
1034
+ for i := 0; i < 4; i++ {
1035
+ parts[i] = x.get(i)
1036
+ }
1037
+ return sliceToString(parts[:])
1038
+ }
1039
+
1040
+ // Sub returns the element-wise difference of x and y.
1041
+ func (x Int32s) Sub(y Int32s) Int32s {
1042
+ var res Int32s
1043
+ for i := 0; i < 4; i++ {
1044
+ res.set(i, x.get(i)-y.get(i))
1045
+ }
1046
+ return res
1047
+ }
1048
+
1049
+ // ToMask returns a mask representation of the vector.
1050
+ func (x Int32s) ToMask() Mask32s {
1051
+ var res Mask32s
1052
+ for i := 0; i < 4; i++ {
1053
+ if x.get(i) != 0 {
1054
+ res.set(i, true)
1055
+ }
1056
+ }
1057
+ return res
1058
+ }
1059
+
1060
+ // Xor returns the bitwise XOR of x and y.
1061
+ func (x Int32s) Xor(y Int32s) Int32s {
1062
+ return Int32s{a: x.a ^ y.a, b: x.b ^ y.b}
1063
+ }
1064
+
1065
+ // ConvertToUint32 converts the vector elements to uint32.
1066
+ func (x Int32s) ConvertToUint32() Uint32s {
1067
+ return Uint32s{a: x.a, b: x.b}
1068
+ }
1069
+
1070
+ // ToBits reinterprets the vector bits as a Uint32s vector.
1071
+ func (x Int32s) ToBits() Uint32s {
1072
+ return Uint32s{a: x.a, b: x.b}
1073
+ }
1074
+
1075
+ // LoadInt64s loads a slice of int64 into an Int64s vector.
1076
+ func LoadInt64s(s []int64) Int64s {
1077
+ var a, b uint64
1078
+ a = uint64(s[0])
1079
+ b = uint64(s[1])
1080
+ return Int64s{a: a, b: b}
1081
+ }
1082
+
1083
+ // LoadInt64sPart loads a partial slice of int64 into an Int64s vector.
1084
+ func LoadInt64sPart(s []int64) (Int64s, int) {
1085
+ var a, b uint64
1086
+ if len(s) > 0 {
1087
+ a = uint64(s[0])
1088
+ }
1089
+ if len(s) > 1 {
1090
+ b = uint64(s[1])
1091
+ }
1092
+ return Int64s{a: a, b: b}, len(s)
1093
+ }
1094
+
1095
+ func (x Int64s) get(i int) int64 {
1096
+ if i == 0 {
1097
+ return int64(x.a)
1098
+ }
1099
+ return int64(x.b)
1100
+ }
1101
+
1102
+ func (x *Int64s) set(i int, v int64) {
1103
+ if i == 0 {
1104
+ x.a = uint64(v)
1105
+ } else {
1106
+ x.b = uint64(v)
1107
+ }
1108
+ }
1109
+
1110
+ // Add returns the element-wise sum of x and y.
1111
+ func (x Int64s) Add(y Int64s) Int64s {
1112
+ return Int64s{a: x.a + y.a, b: x.b + y.b}
1113
+ }
1114
+
1115
+ // And returns the bitwise AND of x and y.
1116
+ func (x Int64s) And(y Int64s) Int64s {
1117
+ return Int64s{a: x.a & y.a, b: x.b & y.b}
1118
+ }
1119
+
1120
+ // AndNot returns the bitwise AND NOT of x and y.
1121
+ func (x Int64s) AndNot(y Int64s) Int64s {
1122
+ return Int64s{a: x.a &^ y.a, b: x.b &^ y.b}
1123
+ }
1124
+
1125
+ // Equal returns a mask indicating where x and y are equal.
1126
+ func (x Int64s) Equal(y Int64s) Mask64s {
1127
+ var res Mask64s
1128
+ if x.a == y.a {
1129
+ res.a = ^uint64(0)
1130
+ }
1131
+ if x.b == y.b {
1132
+ res.b = ^uint64(0)
1133
+ }
1134
+ return res
1135
+ }
1136
+
1137
+ // Greater returns a mask indicating where x is greater than y.
1138
+ func (x Int64s) Greater(y Int64s) Mask64s {
1139
+ var res Mask64s
1140
+ if int64(x.a) > int64(y.a) {
1141
+ res.a = ^uint64(0)
1142
+ }
1143
+ if int64(x.b) > int64(y.b) {
1144
+ res.b = ^uint64(0)
1145
+ }
1146
+ return res
1147
+ }
1148
+
1149
+ // GreaterEqual returns a mask indicating where x is greater than or equal to y.
1150
+ func (x Int64s) GreaterEqual(y Int64s) Mask64s {
1151
+ var res Mask64s
1152
+ if int64(x.a) >= int64(y.a) {
1153
+ res.a = ^uint64(0)
1154
+ }
1155
+ if int64(x.b) >= int64(y.b) {
1156
+ res.b = ^uint64(0)
1157
+ }
1158
+ return res
1159
+ }
1160
+
1161
+ // Less returns a mask indicating where x is less than y.
1162
+ func (x Int64s) Less(y Int64s) Mask64s {
1163
+ var res Mask64s
1164
+ if int64(x.a) < int64(y.a) {
1165
+ res.a = ^uint64(0)
1166
+ }
1167
+ if int64(x.b) < int64(y.b) {
1168
+ res.b = ^uint64(0)
1169
+ }
1170
+ return res
1171
+ }
1172
+
1173
+ // LessEqual returns a mask indicating where x is less than or equal to y.
1174
+ func (x Int64s) LessEqual(y Int64s) Mask64s {
1175
+ var res Mask64s
1176
+ if int64(x.a) <= int64(y.a) {
1177
+ res.a = ^uint64(0)
1178
+ }
1179
+ if int64(x.b) <= int64(y.b) {
1180
+ res.b = ^uint64(0)
1181
+ }
1182
+ return res
1183
+ }
1184
+
1185
+ // NotEqual returns a mask indicating where x and y are not equal.
1186
+ func (x Int64s) NotEqual(y Int64s) Mask64s {
1187
+ var res Mask64s
1188
+ if x.a != y.a {
1189
+ res.a = ^uint64(0)
1190
+ }
1191
+ if x.b != y.b {
1192
+ res.b = ^uint64(0)
1193
+ }
1194
+ return res
1195
+ }
1196
+
1197
+ // Len returns the number of elements in the vector.
1198
+ func (x Int64s) Len() int {
1199
+ return 2
1200
+ }
1201
+
1202
+ // Masked returns a new vector with elements from x where mask is true, and zero elsewhere.
1203
+ func (x Int64s) Masked(mask Mask64s) Int64s {
1204
+ return Int64s{a: x.a & mask.a, b: x.b & mask.b}
1205
+ }
1206
+
1207
+ // IfElse returns a new vector with elements from x where mask is true, and y where mask is false.
1208
+ func (x Int64s) IfElse(mask Mask64s, y Int64s) Int64s {
1209
+ return Int64s{
1210
+ a: (x.a & mask.a) | (y.a &^ mask.a),
1211
+ b: (x.b & mask.b) | (y.b &^ mask.b),
1212
+ }
1213
+ }
1214
+
1215
+ // Neg returns the element-wise negation of x.
1216
+ func (x Int64s) Neg() Int64s {
1217
+ return Int64s{a: uint64(-int64(x.a)), b: uint64(-int64(x.b))}
1218
+ }
1219
+
1220
+ // Not returns the bitwise NOT of x.
1221
+ func (x Int64s) Not() Int64s {
1222
+ return Int64s{a: ^x.a, b: ^x.b}
1223
+ }
1224
+
1225
+ // Or returns the bitwise OR of x and y.
1226
+ func (x Int64s) Or(y Int64s) Int64s {
1227
+ return Int64s{a: x.a | y.a, b: x.b | y.b}
1228
+ }
1229
+
1230
+ // ShiftAllLeft shifts all elements left by y bits.
1231
+ func (x Int64s) ShiftAllLeft(y uint64) Int64s {
1232
+ return Int64s{a: x.a << y, b: x.b << y}
1233
+ }
1234
+
1235
+ // RotateAllLeft rotates all elements left by dist bits.
1236
+ func (x Int64s) RotateAllLeft(dist uint64) Int64s {
1237
+ d := dist & 63
1238
+ return Int64s{
1239
+ a: (x.a << d) | (x.a >> ((64 - d) & 63)),
1240
+ b: (x.b << d) | (x.b >> ((64 - d) & 63)),
1241
+ }
1242
+ }
1243
+
1244
+ // RotateAllRight rotates all elements right by dist bits.
1245
+ func (x Int64s) RotateAllRight(dist uint64) Int64s {
1246
+ d := dist & 63
1247
+ return Int64s{
1248
+ a: (x.a >> d) | (x.a << ((64 - d) & 63)),
1249
+ b: (x.b >> d) | (x.b << ((64 - d) & 63)),
1250
+ }
1251
+ }
1252
+
1253
+ // Store stores the vector elements into the slice s.
1254
+ func (x Int64s) Store(s []int64) {
1255
+ if len(s) > 0 {
1256
+ s[0] = int64(x.a)
1257
+ }
1258
+ if len(s) > 1 {
1259
+ s[1] = int64(x.b)
1260
+ }
1261
+ }
1262
+
1263
+ // StorePart stores a partial vector into the slice s.
1264
+ func (x Int64s) StorePart(s []int64) int {
1265
+ x.Store(s)
1266
+ return min(len(s), x.Len())
1267
+ }
1268
+
1269
+ // String returns a string representation of the vector.
1270
+ func (x Int64s) String() string {
1271
+ return sliceToString([]int64{int64(x.a), int64(x.b)})
1272
+ }
1273
+
1274
+ // Sub returns the element-wise difference of x and y.
1275
+ func (x Int64s) Sub(y Int64s) Int64s {
1276
+ return Int64s{a: x.a - y.a, b: x.b - y.b}
1277
+ }
1278
+
1279
+ // ToMask returns a mask representation of the vector.
1280
+ func (x Int64s) ToMask() Mask64s {
1281
+ var res Mask64s
1282
+ if x.a != 0 {
1283
+ res.a = ^uint64(0)
1284
+ }
1285
+ if x.b != 0 {
1286
+ res.b = ^uint64(0)
1287
+ }
1288
+ return res
1289
+ }
1290
+
1291
+ // Xor returns the bitwise XOR of x and y.
1292
+ func (x Int64s) Xor(y Int64s) Int64s {
1293
+ return Int64s{a: x.a ^ y.a, b: x.b ^ y.b}
1294
+ }
1295
+
1296
+ // ConvertToUint64 converts the vector elements to uint64.
1297
+ func (x Int64s) ConvertToUint64() Uint64s {
1298
+ return Uint64s{a: x.a, b: x.b}
1299
+ }
1300
+
1301
+ // ToBits reinterprets the vector bits as a Uint64s vector.
1302
+ func (x Int64s) ToBits() Uint64s {
1303
+ return Uint64s{a: x.a, b: x.b}
1304
+ }
1305
+
1306
+ // LoadUint8s loads a slice of uint8 into an Uint8s vector.
1307
+ func LoadUint8s(s []uint8) Uint8s {
1308
+ var a, b uint64
1309
+ for i := 0; i < 16; i++ {
1310
+ val := uint64(s[i])
1311
+ if i < 8 {
1312
+ a |= val << (8 * i)
1313
+ } else {
1314
+ b |= val << (8 * (i - 8))
1315
+ }
1316
+ }
1317
+ return Uint8s{a: a, b: b}
1318
+ }
1319
+
1320
+ // LoadUint8sPart loads a partial slice of uint8 into an Uint8s vector.
1321
+ func LoadUint8sPart(s []uint8) (Uint8s, int) {
1322
+ var a, b uint64
1323
+ n := len(s)
1324
+ if n > 16 {
1325
+ n = 16
1326
+ }
1327
+ for i := 0; i < n; i++ {
1328
+ val := uint64(s[i])
1329
+ if i < 8 {
1330
+ a |= val << (8 * i)
1331
+ } else {
1332
+ b |= val << (8 * (i - 8))
1333
+ }
1334
+ }
1335
+ return Uint8s{a: a, b: b}, n
1336
+ }
1337
+
1338
+ func (x Uint8s) get(i int) uint8 {
1339
+ if i < 8 {
1340
+ return uint8(x.a >> (8 * i))
1341
+ }
1342
+ return uint8(x.b >> (8 * (i - 8)))
1343
+ }
1344
+
1345
+ func (x *Uint8s) set(i int, v uint8) {
1346
+ val := uint64(v)
1347
+ if i < 8 {
1348
+ mask := uint64(0xff) << (8 * i)
1349
+ x.a = (x.a &^ mask) | (val << (8 * i))
1350
+ } else {
1351
+ mask := uint64(0xff) << (8 * (i - 8))
1352
+ x.b = (x.b &^ mask) | (val << (8 * (i - 8)))
1353
+ }
1354
+ }
1355
+
1356
+ // Add returns the element-wise sum of x and y.
1357
+ func (x Uint8s) Add(y Uint8s) Uint8s {
1358
+ var res Uint8s
1359
+ for i := 0; i < 16; i++ {
1360
+ res.set(i, x.get(i)+y.get(i))
1361
+ }
1362
+ return res
1363
+ }
1364
+
1365
+ // AddSaturated returns the element-wise saturated sum of x and y.
1366
+ func (x Uint8s) AddSaturated(y Uint8s) Uint8s {
1367
+ var res Uint8s
1368
+ for i := 0; i < 16; i++ {
1369
+ sum := int(x.get(i)) + int(y.get(i))
1370
+ if sum > math.MaxUint8 {
1371
+ res.set(i, math.MaxUint8)
1372
+ } else {
1373
+ res.set(i, uint8(sum))
1374
+ }
1375
+ }
1376
+ return res
1377
+ }
1378
+
1379
+ // And returns the bitwise AND of x and y.
1380
+ func (x Uint8s) And(y Uint8s) Uint8s {
1381
+ return Uint8s{a: x.a & y.a, b: x.b & y.b}
1382
+ }
1383
+
1384
+ // AndNot returns the bitwise AND NOT of x and y.
1385
+ func (x Uint8s) AndNot(y Uint8s) Uint8s {
1386
+ return Uint8s{a: x.a &^ y.a, b: x.b &^ y.b}
1387
+ }
1388
+
1389
+ // Average returns the element-wise average of x and y.
1390
+ func (x Uint8s) Average(y Uint8s) Uint8s {
1391
+ var res Uint8s
1392
+ for i := 0; i < 16; i++ {
1393
+ res.set(i, uint8((int(x.get(i))+int(y.get(i))+1)>>1))
1394
+ }
1395
+ return res
1396
+ }
1397
+
1398
+ // Equal returns a mask indicating where x and y are equal.
1399
+ func (x Uint8s) Equal(y Uint8s) Mask8s {
1400
+ var res Mask8s
1401
+ for i := 0; i < 16; i++ {
1402
+ if x.get(i) == y.get(i) {
1403
+ res.set(i, true)
1404
+ }
1405
+ }
1406
+ return res
1407
+ }
1408
+
1409
+ // NotEqual returns a mask indicating where x and y are not equal.
1410
+ func (x Uint8s) NotEqual(y Uint8s) Mask8s {
1411
+ var res Mask8s
1412
+ for i := 0; i < 16; i++ {
1413
+ if x.get(i) != y.get(i) {
1414
+ res.set(i, true)
1415
+ }
1416
+ }
1417
+ return res
1418
+ }
1419
+
1420
+ // Len returns the number of elements in the vector.
1421
+ func (x Uint8s) Len() int {
1422
+ return 16
1423
+ }
1424
+
1425
+ // Masked returns a new vector with elements from x where mask is true, and zero elsewhere.
1426
+ func (x Uint8s) Masked(mask Mask8s) Uint8s {
1427
+ return Uint8s{a: x.a & mask.a, b: x.b & mask.b}
1428
+ }
1429
+
1430
+ // Max returns the element-wise maximum of x and y.
1431
+ func (x Uint8s) Max(y Uint8s) Uint8s {
1432
+ var res Uint8s
1433
+ for i := 0; i < 16; i++ {
1434
+ vx := x.get(i)
1435
+ vy := y.get(i)
1436
+ if vx > vy {
1437
+ res.set(i, vx)
1438
+ } else {
1439
+ res.set(i, vy)
1440
+ }
1441
+ }
1442
+ return res
1443
+ }
1444
+
1445
+ // IfElse returns a new vector with elements from x where mask is true, and y where mask is false.
1446
+ func (x Uint8s) IfElse(mask Mask8s, y Uint8s) Uint8s {
1447
+ return Uint8s{
1448
+ a: (x.a & mask.a) | (y.a &^ mask.a),
1449
+ b: (x.b & mask.b) | (y.b &^ mask.b),
1450
+ }
1451
+ }
1452
+
1453
+ // Min returns the element-wise minimum of x and y.
1454
+ func (x Uint8s) Min(y Uint8s) Uint8s {
1455
+ var res Uint8s
1456
+ for i := 0; i < 16; i++ {
1457
+ vx := x.get(i)
1458
+ vy := y.get(i)
1459
+ if vx < vy {
1460
+ res.set(i, vx)
1461
+ } else {
1462
+ res.set(i, vy)
1463
+ }
1464
+ }
1465
+ return res
1466
+ }
1467
+
1468
+ // Mul returns the element-wise product of x and y.
1469
+ func (x Uint8s) Mul(y Uint8s) Uint8s {
1470
+ var res Uint8s
1471
+ for i := 0; i < 16; i++ {
1472
+ res.set(i, x.get(i)*y.get(i))
1473
+ }
1474
+ return res
1475
+ }
1476
+
1477
+ // Not returns the bitwise NOT of x.
1478
+ func (x Uint8s) Not() Uint8s {
1479
+ return Uint8s{a: ^x.a, b: ^x.b}
1480
+ }
1481
+
1482
+ // Or returns the bitwise OR of x and y.
1483
+ func (x Uint8s) Or(y Uint8s) Uint8s {
1484
+ return Uint8s{a: x.a | y.a, b: x.b | y.b}
1485
+ }
1486
+
1487
+ // Store stores the vector elements into the slice s.
1488
+ func (x Uint8s) Store(s []uint8) {
1489
+ for i := 0; i < 16 && i < len(s); i++ {
1490
+ s[i] = x.get(i)
1491
+ }
1492
+ }
1493
+
1494
+ // StorePart stores a partial vector into the slice s.
1495
+ func (x Uint8s) StorePart(s []uint8) int {
1496
+ x.Store(s)
1497
+ return min(len(s), x.Len())
1498
+ }
1499
+
1500
+ // String returns a string representation of the vector.
1501
+ func (x Uint8s) String() string {
1502
+ var parts [16]uint8
1503
+ for i := 0; i < 16; i++ {
1504
+ parts[i] = x.get(i)
1505
+ }
1506
+ return sliceToString(parts[:])
1507
+ }
1508
+
1509
+ // Sub returns the element-wise difference of x and y.
1510
+ func (x Uint8s) Sub(y Uint8s) Uint8s {
1511
+ var res Uint8s
1512
+ for i := 0; i < 16; i++ {
1513
+ res.set(i, x.get(i)-y.get(i))
1514
+ }
1515
+ return res
1516
+ }
1517
+
1518
+ // SubSaturated returns the element-wise saturated difference of x and y.
1519
+ func (x Uint8s) SubSaturated(y Uint8s) Uint8s {
1520
+ var res Uint8s
1521
+ for i := 0; i < 16; i++ {
1522
+ vx := x.get(i)
1523
+ vy := y.get(i)
1524
+ if vx < vy {
1525
+ res.set(i, 0)
1526
+ } else {
1527
+ res.set(i, vx-vy)
1528
+ }
1529
+ }
1530
+ return res
1531
+ }
1532
+
1533
+ // Xor returns the bitwise XOR of x and y.
1534
+ func (x Uint8s) Xor(y Uint8s) Uint8s {
1535
+ return Uint8s{a: x.a ^ y.a, b: x.b ^ y.b}
1536
+ }
1537
+
1538
+ // BitsToInt8 reinterprets the vector bits as an Int8s vector.
1539
+ func (x Uint8s) BitsToInt8() Int8s {
1540
+ return Int8s{a: x.a, b: x.b}
1541
+ }
1542
+
1543
+ // ConvertToInt8 converts the vector elements to int8.
1544
+ func (x Uint8s) ConvertToInt8() Int8s {
1545
+ return Int8s{a: x.a, b: x.b}
1546
+ }
1547
+
1548
+ // ReshapeToUint16s reinterprets the vector bits as a Uint16s vector.
1549
+ func (x Uint8s) ReshapeToUint16s() Uint16s {
1550
+ return Uint16s{a: x.a, b: x.b}
1551
+ }
1552
+
1553
+ // ReshapeToUint32s reinterprets the vector bits as a Uint32s vector.
1554
+ func (x Uint8s) ReshapeToUint32s() Uint32s {
1555
+ return Uint32s{a: x.a, b: x.b}
1556
+ }
1557
+
1558
+ // ReshapeToUint64s reinterprets the vector bits as a Uint64s vector.
1559
+ func (x Uint8s) ReshapeToUint64s() Uint64s {
1560
+ return Uint64s{a: x.a, b: x.b}
1561
+ }
1562
+
1563
+ // LoadUint16s loads a slice of uint16 into an Uint16s vector.
1564
+ func LoadUint16s(s []uint16) Uint16s {
1565
+ var a, b uint64
1566
+ for i := 0; i < 8; i++ {
1567
+ val := uint64(s[i])
1568
+ if i < 4 {
1569
+ a |= val << (16 * i)
1570
+ } else {
1571
+ b |= val << (16 * (i - 4))
1572
+ }
1573
+ }
1574
+ return Uint16s{a: a, b: b}
1575
+ }
1576
+
1577
+ // LoadUint16sPart loads a partial slice of uint16 into an Uint16s vector.
1578
+ func LoadUint16sPart(s []uint16) (Uint16s, int) {
1579
+ var a, b uint64
1580
+ n := len(s)
1581
+ if n > 8 {
1582
+ n = 8
1583
+ }
1584
+ for i := 0; i < n; i++ {
1585
+ val := uint64(s[i])
1586
+ if i < 4 {
1587
+ a |= val << (16 * i)
1588
+ } else {
1589
+ b |= val << (16 * (i - 4))
1590
+ }
1591
+ }
1592
+ return Uint16s{a: a, b: b}, n
1593
+ }
1594
+
1595
+ func (x Uint16s) get(i int) uint16 {
1596
+ if i < 4 {
1597
+ return uint16(x.a >> (16 * i))
1598
+ }
1599
+ return uint16(x.b >> (16 * (i - 4)))
1600
+ }
1601
+
1602
+ func (x *Uint16s) set(i int, v uint16) {
1603
+ val := uint64(v)
1604
+ if i < 4 {
1605
+ mask := uint64(0xffff) << (16 * i)
1606
+ x.a = (x.a &^ mask) | (val << (16 * i))
1607
+ } else {
1608
+ mask := uint64(0xffff) << (16 * (i - 4))
1609
+ x.b = (x.b &^ mask) | (val << (16 * (i - 4)))
1610
+ }
1611
+ }
1612
+
1613
+ // Add returns the element-wise sum of x and y.
1614
+ func (x Uint16s) Add(y Uint16s) Uint16s {
1615
+ var res Uint16s
1616
+ for i := 0; i < 8; i++ {
1617
+ res.set(i, x.get(i)+y.get(i))
1618
+ }
1619
+ return res
1620
+ }
1621
+
1622
+ // AddSaturated returns the element-wise saturated sum of x and y.
1623
+ func (x Uint16s) AddSaturated(y Uint16s) Uint16s {
1624
+ var res Uint16s
1625
+ for i := 0; i < 8; i++ {
1626
+ sum := int(x.get(i)) + int(y.get(i))
1627
+ if sum > math.MaxUint16 {
1628
+ res.set(i, math.MaxUint16)
1629
+ } else {
1630
+ res.set(i, uint16(sum))
1631
+ }
1632
+ }
1633
+ return res
1634
+ }
1635
+
1636
+ // And returns the bitwise AND of x and y.
1637
+ func (x Uint16s) And(y Uint16s) Uint16s {
1638
+ return Uint16s{a: x.a & y.a, b: x.b & y.b}
1639
+ }
1640
+
1641
+ // AndNot returns the bitwise AND NOT of x and y.
1642
+ func (x Uint16s) AndNot(y Uint16s) Uint16s {
1643
+ return Uint16s{a: x.a &^ y.a, b: x.b &^ y.b}
1644
+ }
1645
+
1646
+ // Average returns the element-wise average of x and y.
1647
+ func (x Uint16s) Average(y Uint16s) Uint16s {
1648
+ var res Uint16s
1649
+ for i := 0; i < 8; i++ {
1650
+ res.set(i, uint16((int(x.get(i))+int(y.get(i))+1)>>1))
1651
+ }
1652
+ return res
1653
+ }
1654
+
1655
+ // Equal returns a mask indicating where x and y are equal.
1656
+ func (x Uint16s) Equal(y Uint16s) Mask16s {
1657
+ var res Mask16s
1658
+ for i := 0; i < 8; i++ {
1659
+ if x.get(i) == y.get(i) {
1660
+ res.set(i, true)
1661
+ }
1662
+ }
1663
+ return res
1664
+ }
1665
+
1666
+ // Greater returns a mask indicating where x is greater than y.
1667
+ func (x Uint16s) Greater(y Uint16s) Mask16s {
1668
+ var res Mask16s
1669
+ for i := 0; i < 8; i++ {
1670
+ if x.get(i) > y.get(i) {
1671
+ res.set(i, true)
1672
+ }
1673
+ }
1674
+ return res
1675
+ }
1676
+
1677
+ // GreaterEqual returns a mask indicating where x is greater than or equal to y.
1678
+ func (x Uint16s) GreaterEqual(y Uint16s) Mask16s {
1679
+ var res Mask16s
1680
+ for i := 0; i < 8; i++ {
1681
+ if x.get(i) >= y.get(i) {
1682
+ res.set(i, true)
1683
+ }
1684
+ }
1685
+ return res
1686
+ }
1687
+
1688
+ // Less returns a mask indicating where x is less than y.
1689
+ func (x Uint16s) Less(y Uint16s) Mask16s {
1690
+ var res Mask16s
1691
+ for i := 0; i < 8; i++ {
1692
+ if x.get(i) < y.get(i) {
1693
+ res.set(i, true)
1694
+ }
1695
+ }
1696
+ return res
1697
+ }
1698
+
1699
+ // LessEqual returns a mask indicating where x is less than or equal to y.
1700
+ func (x Uint16s) LessEqual(y Uint16s) Mask16s {
1701
+ var res Mask16s
1702
+ for i := 0; i < 8; i++ {
1703
+ if x.get(i) <= y.get(i) {
1704
+ res.set(i, true)
1705
+ }
1706
+ }
1707
+ return res
1708
+ }
1709
+
1710
+ // NotEqual returns a mask indicating where x and y are not equal.
1711
+ func (x Uint16s) NotEqual(y Uint16s) Mask16s {
1712
+ var res Mask16s
1713
+ for i := 0; i < 8; i++ {
1714
+ if x.get(i) != y.get(i) {
1715
+ res.set(i, true)
1716
+ }
1717
+ }
1718
+ return res
1719
+ }
1720
+
1721
+ // Len returns the number of elements in the vector.
1722
+ func (x Uint16s) Len() int {
1723
+ return 8
1724
+ }
1725
+
1726
+ // Masked returns a new vector with elements from x where mask is true, and zero elsewhere.
1727
+ func (x Uint16s) Masked(mask Mask16s) Uint16s {
1728
+ return Uint16s{a: x.a & mask.a, b: x.b & mask.b}
1729
+ }
1730
+
1731
+ // Max returns the element-wise maximum of x and y.
1732
+ func (x Uint16s) Max(y Uint16s) Uint16s {
1733
+ var res Uint16s
1734
+ for i := 0; i < 8; i++ {
1735
+ vx := x.get(i)
1736
+ vy := y.get(i)
1737
+ if vx > vy {
1738
+ res.set(i, vx)
1739
+ } else {
1740
+ res.set(i, vy)
1741
+ }
1742
+ }
1743
+ return res
1744
+ }
1745
+
1746
+ // IfElse returns a new vector with elements from x where mask is true, and y where mask is false.
1747
+ func (x Uint16s) IfElse(mask Mask16s, y Uint16s) Uint16s {
1748
+ return Uint16s{
1749
+ a: (x.a & mask.a) | (y.a &^ mask.a),
1750
+ b: (x.b & mask.b) | (y.b &^ mask.b),
1751
+ }
1752
+ }
1753
+
1754
+ // Min returns the element-wise minimum of x and y.
1755
+ func (x Uint16s) Min(y Uint16s) Uint16s {
1756
+ var res Uint16s
1757
+ for i := 0; i < 8; i++ {
1758
+ vx := x.get(i)
1759
+ vy := y.get(i)
1760
+ if vx < vy {
1761
+ res.set(i, vx)
1762
+ } else {
1763
+ res.set(i, vy)
1764
+ }
1765
+ }
1766
+ return res
1767
+ }
1768
+
1769
+ // Mul returns the element-wise product of x and y.
1770
+ func (x Uint16s) Mul(y Uint16s) Uint16s {
1771
+ var res Uint16s
1772
+ for i := 0; i < 8; i++ {
1773
+ res.set(i, x.get(i)*y.get(i))
1774
+ }
1775
+ return res
1776
+ }
1777
+
1778
+ // Not returns the bitwise NOT of x.
1779
+ func (x Uint16s) Not() Uint16s {
1780
+ return Uint16s{a: ^x.a, b: ^x.b}
1781
+ }
1782
+
1783
+ // Or returns the bitwise OR of x and y.
1784
+ func (x Uint16s) Or(y Uint16s) Uint16s {
1785
+ return Uint16s{a: x.a | y.a, b: x.b | y.b}
1786
+ }
1787
+
1788
+ // ShiftAllLeft shifts all elements left by y bits.
1789
+ func (x Uint16s) ShiftAllLeft(y uint64) Uint16s {
1790
+ var res Uint16s
1791
+ for i := 0; i < 8; i++ {
1792
+ res.set(i, x.get(i)<<y)
1793
+ }
1794
+ return res
1795
+ }
1796
+
1797
+ // ShiftAllRight shifts all elements right by y bits.
1798
+ func (x Uint16s) ShiftAllRight(y uint64) Uint16s {
1799
+ var res Uint16s
1800
+ for i := 0; i < 8; i++ {
1801
+ res.set(i, x.get(i)>>y)
1802
+ }
1803
+ return res
1804
+ }
1805
+
1806
+ // RotateAllLeft rotates all elements left by dist bits.
1807
+ func (x Uint16s) RotateAllLeft(dist uint64) Uint16s {
1808
+ var res Uint16s
1809
+ d := dist & 15
1810
+ for i := 0; i < 8; i++ {
1811
+ u := x.get(i)
1812
+ r := (u << d) | (u >> ((16 - d) & 15))
1813
+ res.set(i, r)
1814
+ }
1815
+ return res
1816
+ }
1817
+
1818
+ // RotateAllRight rotates all elements right by dist bits.
1819
+ func (x Uint16s) RotateAllRight(dist uint64) Uint16s {
1820
+ var res Uint16s
1821
+ d := dist & 15
1822
+ for i := 0; i < 8; i++ {
1823
+ u := x.get(i)
1824
+ r := (u >> d) | (u << ((16 - d) & 15))
1825
+ res.set(i, r)
1826
+ }
1827
+ return res
1828
+ }
1829
+
1830
+ // Store stores the vector elements into the slice s.
1831
+ func (x Uint16s) Store(s []uint16) {
1832
+ for i := 0; i < 8 && i < len(s); i++ {
1833
+ s[i] = x.get(i)
1834
+ }
1835
+ }
1836
+
1837
+ // StorePart stores a partial vector into the slice s.
1838
+ func (x Uint16s) StorePart(s []uint16) int {
1839
+ x.Store(s)
1840
+ return min(len(s), x.Len())
1841
+ }
1842
+
1843
+ // String returns a string representation of the vector.
1844
+ func (x Uint16s) String() string {
1845
+ var parts [8]uint16
1846
+ for i := 0; i < 8; i++ {
1847
+ parts[i] = x.get(i)
1848
+ }
1849
+ return sliceToString(parts[:])
1850
+ }
1851
+
1852
+ // Sub returns the element-wise difference of x and y.
1853
+ func (x Uint16s) Sub(y Uint16s) Uint16s {
1854
+ var res Uint16s
1855
+ for i := 0; i < 8; i++ {
1856
+ res.set(i, x.get(i)-y.get(i))
1857
+ }
1858
+ return res
1859
+ }
1860
+
1861
+ // SubSaturated returns the element-wise saturated difference of x and y.
1862
+ func (x Uint16s) SubSaturated(y Uint16s) Uint16s {
1863
+ var res Uint16s
1864
+ for i := 0; i < 8; i++ {
1865
+ vx := x.get(i)
1866
+ vy := y.get(i)
1867
+ if vx < vy {
1868
+ res.set(i, 0)
1869
+ } else {
1870
+ res.set(i, vx-vy)
1871
+ }
1872
+ }
1873
+ return res
1874
+ }
1875
+
1876
+ // Xor returns the bitwise XOR of x and y.
1877
+ func (x Uint16s) Xor(y Uint16s) Uint16s {
1878
+ return Uint16s{a: x.a ^ y.a, b: x.b ^ y.b}
1879
+ }
1880
+
1881
+ // BitsToInt16 reinterprets the vector bits as an Int16s vector.
1882
+ func (x Uint16s) BitsToInt16() Int16s {
1883
+ return Int16s{a: x.a, b: x.b}
1884
+ }
1885
+
1886
+ // ConvertToInt16 converts the vector elements to int16.
1887
+ func (x Uint16s) ConvertToInt16() Int16s {
1888
+ return Int16s{a: x.a, b: x.b}
1889
+ }
1890
+
1891
+ // ReshapeToUint32s reinterprets the vector bits as a Uint32s vector.
1892
+ func (x Uint16s) ReshapeToUint32s() Uint32s {
1893
+ return Uint32s{a: x.a, b: x.b}
1894
+ }
1895
+
1896
+ // ReshapeToUint64s reinterprets the vector bits as a Uint64s vector.
1897
+ func (x Uint16s) ReshapeToUint64s() Uint64s {
1898
+ return Uint64s{a: x.a, b: x.b}
1899
+ }
1900
+
1901
+ // ReshapeToUint8s reinterprets the vector bits as a Uint8s vector.
1902
+ func (x Uint16s) ReshapeToUint8s() Uint8s {
1903
+ return Uint8s{a: x.a, b: x.b}
1904
+ }
1905
+
1906
+ // LoadUint32s loads a slice of uint32 into an Uint32s vector.
1907
+ func LoadUint32s(s []uint32) Uint32s {
1908
+ var a, b uint64
1909
+ for i := 0; i < 4; i++ {
1910
+ val := uint64(s[i])
1911
+ if i < 2 {
1912
+ a |= val << (32 * i)
1913
+ } else {
1914
+ b |= val << (32 * (i - 2))
1915
+ }
1916
+ }
1917
+ return Uint32s{a: a, b: b}
1918
+ }
1919
+
1920
+ // LoadUint32sPart loads a partial slice of uint32 into an Uint32s vector.
1921
+ func LoadUint32sPart(s []uint32) (Uint32s, int) {
1922
+ var a, b uint64
1923
+ n := len(s)
1924
+ if n > 4 {
1925
+ n = 4
1926
+ }
1927
+ for i := 0; i < n; i++ {
1928
+ val := uint64(s[i])
1929
+ if i < 2 {
1930
+ a |= val << (32 * i)
1931
+ } else {
1932
+ b |= val << (32 * (i - 2))
1933
+ }
1934
+ }
1935
+ return Uint32s{a: a, b: b}, n
1936
+ }
1937
+
1938
+ func (x Uint32s) get(i int) uint32 {
1939
+ if i < 2 {
1940
+ return uint32(x.a >> (32 * i))
1941
+ }
1942
+ return uint32(x.b >> (32 * (i - 2)))
1943
+ }
1944
+
1945
+ func (x *Uint32s) set(i int, v uint32) {
1946
+ val := uint64(v)
1947
+ if i < 2 {
1948
+ mask := uint64(0xffffffff) << (32 * i)
1949
+ x.a = (x.a &^ mask) | (val << (32 * i))
1950
+ } else {
1951
+ mask := uint64(0xffffffff) << (32 * (i - 2))
1952
+ x.b = (x.b &^ mask) | (val << (32 * (i - 2)))
1953
+ }
1954
+ }
1955
+
1956
+ // Add returns the element-wise sum of x and y.
1957
+ func (x Uint32s) Add(y Uint32s) Uint32s {
1958
+ var res Uint32s
1959
+ for i := 0; i < 4; i++ {
1960
+ res.set(i, x.get(i)+y.get(i))
1961
+ }
1962
+ return res
1963
+ }
1964
+
1965
+ // And returns the bitwise AND of x and y.
1966
+ func (x Uint32s) And(y Uint32s) Uint32s {
1967
+ return Uint32s{a: x.a & y.a, b: x.b & y.b}
1968
+ }
1969
+
1970
+ // AndNot returns the bitwise AND NOT of x and y.
1971
+ func (x Uint32s) AndNot(y Uint32s) Uint32s {
1972
+ return Uint32s{a: x.a &^ y.a, b: x.b &^ y.b}
1973
+ }
1974
+
1975
+ // Equal returns a mask indicating where x and y are equal.
1976
+ func (x Uint32s) Equal(y Uint32s) Mask32s {
1977
+ var res Mask32s
1978
+ for i := 0; i < 4; i++ {
1979
+ if x.get(i) == y.get(i) {
1980
+ res.set(i, true)
1981
+ }
1982
+ }
1983
+ return res
1984
+ }
1985
+
1986
+ // Greater returns a mask indicating where x is greater than y.
1987
+ func (x Uint32s) Greater(y Uint32s) Mask32s {
1988
+ var res Mask32s
1989
+ for i := 0; i < 4; i++ {
1990
+ if x.get(i) > y.get(i) {
1991
+ res.set(i, true)
1992
+ }
1993
+ }
1994
+ return res
1995
+ }
1996
+
1997
+ // GreaterEqual returns a mask indicating where x is greater than or equal to y.
1998
+ func (x Uint32s) GreaterEqual(y Uint32s) Mask32s {
1999
+ var res Mask32s
2000
+ for i := 0; i < 4; i++ {
2001
+ if x.get(i) >= y.get(i) {
2002
+ res.set(i, true)
2003
+ }
2004
+ }
2005
+ return res
2006
+ }
2007
+
2008
+ // Less returns a mask indicating where x is less than y.
2009
+ func (x Uint32s) Less(y Uint32s) Mask32s {
2010
+ var res Mask32s
2011
+ for i := 0; i < 4; i++ {
2012
+ if x.get(i) < y.get(i) {
2013
+ res.set(i, true)
2014
+ }
2015
+ }
2016
+ return res
2017
+ }
2018
+
2019
+ // LessEqual returns a mask indicating where x is less than or equal to y.
2020
+ func (x Uint32s) LessEqual(y Uint32s) Mask32s {
2021
+ var res Mask32s
2022
+ for i := 0; i < 4; i++ {
2023
+ if x.get(i) <= y.get(i) {
2024
+ res.set(i, true)
2025
+ }
2026
+ }
2027
+ return res
2028
+ }
2029
+
2030
+ // NotEqual returns a mask indicating where x and y are not equal.
2031
+ func (x Uint32s) NotEqual(y Uint32s) Mask32s {
2032
+ var res Mask32s
2033
+ for i := 0; i < 4; i++ {
2034
+ if x.get(i) != y.get(i) {
2035
+ res.set(i, true)
2036
+ }
2037
+ }
2038
+ return res
2039
+ }
2040
+
2041
+ // Len returns the number of elements in the vector.
2042
+ func (x Uint32s) Len() int {
2043
+ return 4
2044
+ }
2045
+
2046
+ // Masked returns a new vector with elements from x where mask is true, and zero elsewhere.
2047
+ func (x Uint32s) Masked(mask Mask32s) Uint32s {
2048
+ return Uint32s{a: x.a & mask.a, b: x.b & mask.b}
2049
+ }
2050
+
2051
+ // Max returns the element-wise maximum of x and y.
2052
+ func (x Uint32s) Max(y Uint32s) Uint32s {
2053
+ var res Uint32s
2054
+ for i := 0; i < 4; i++ {
2055
+ vx := x.get(i)
2056
+ vy := y.get(i)
2057
+ if vx > vy {
2058
+ res.set(i, vx)
2059
+ } else {
2060
+ res.set(i, vy)
2061
+ }
2062
+ }
2063
+ return res
2064
+ }
2065
+
2066
+ // IfElse returns a new vector with elements from x where mask is true, and y where mask is false.
2067
+ func (x Uint32s) IfElse(mask Mask32s, y Uint32s) Uint32s {
2068
+ return Uint32s{
2069
+ a: (x.a & mask.a) | (y.a &^ mask.a),
2070
+ b: (x.b & mask.b) | (y.b &^ mask.b),
2071
+ }
2072
+ }
2073
+
2074
+ // Min returns the element-wise minimum of x and y.
2075
+ func (x Uint32s) Min(y Uint32s) Uint32s {
2076
+ var res Uint32s
2077
+ for i := 0; i < 4; i++ {
2078
+ vx := x.get(i)
2079
+ vy := y.get(i)
2080
+ if vx < vy {
2081
+ res.set(i, vx)
2082
+ } else {
2083
+ res.set(i, vy)
2084
+ }
2085
+ }
2086
+ return res
2087
+ }
2088
+
2089
+ // Mul returns the element-wise product of x and y.
2090
+ func (x Uint32s) Mul(y Uint32s) Uint32s {
2091
+ var res Uint32s
2092
+ for i := 0; i < 4; i++ {
2093
+ res.set(i, x.get(i)*y.get(i))
2094
+ }
2095
+ return res
2096
+ }
2097
+
2098
+ // Not returns the bitwise NOT of x.
2099
+ func (x Uint32s) Not() Uint32s {
2100
+ return Uint32s{a: ^x.a, b: ^x.b}
2101
+ }
2102
+
2103
+ // Or returns the bitwise OR of x and y.
2104
+ func (x Uint32s) Or(y Uint32s) Uint32s {
2105
+ return Uint32s{a: x.a | y.a, b: x.b | y.b}
2106
+ }
2107
+
2108
+ // ShiftAllLeft shifts all elements left by y bits.
2109
+ func (x Uint32s) ShiftAllLeft(y uint64) Uint32s {
2110
+ var res Uint32s
2111
+ for i := 0; i < 4; i++ {
2112
+ res.set(i, x.get(i)<<y)
2113
+ }
2114
+ return res
2115
+ }
2116
+
2117
+ // ShiftAllRight shifts all elements right by y bits.
2118
+ func (x Uint32s) ShiftAllRight(y uint64) Uint32s {
2119
+ var res Uint32s
2120
+ for i := 0; i < 4; i++ {
2121
+ res.set(i, x.get(i)>>y)
2122
+ }
2123
+ return res
2124
+ }
2125
+
2126
+ // RotateAllLeft rotates all elements left by dist bits.
2127
+ func (x Uint32s) RotateAllLeft(dist uint64) Uint32s {
2128
+ var res Uint32s
2129
+ d := dist & 31
2130
+ for i := 0; i < 4; i++ {
2131
+ u := x.get(i)
2132
+ r := (u << d) | (u >> ((32 - d) & 31))
2133
+ res.set(i, r)
2134
+ }
2135
+ return res
2136
+ }
2137
+
2138
+ // RotateAllRight rotates all elements right by dist bits.
2139
+ func (x Uint32s) RotateAllRight(dist uint64) Uint32s {
2140
+ var res Uint32s
2141
+ d := dist & 31
2142
+ for i := 0; i < 4; i++ {
2143
+ u := x.get(i)
2144
+ r := (u >> d) | (u << ((32 - d) & 31))
2145
+ res.set(i, r)
2146
+ }
2147
+ return res
2148
+ }
2149
+
2150
+ // Store stores the vector elements into the slice s.
2151
+ func (x Uint32s) Store(s []uint32) {
2152
+ for i := 0; i < 4 && i < len(s); i++ {
2153
+ s[i] = x.get(i)
2154
+ }
2155
+ }
2156
+
2157
+ // StorePart stores a partial vector into the slice s.
2158
+ func (x Uint32s) StorePart(s []uint32) int {
2159
+ x.Store(s)
2160
+ return min(len(s), x.Len())
2161
+ }
2162
+
2163
+ // String returns a string representation of the vector.
2164
+ func (x Uint32s) String() string {
2165
+ var parts [4]uint32
2166
+ for i := 0; i < 4; i++ {
2167
+ parts[i] = x.get(i)
2168
+ }
2169
+ return sliceToString(parts[:])
2170
+ }
2171
+
2172
+ // Sub returns the element-wise difference of x and y.
2173
+ func (x Uint32s) Sub(y Uint32s) Uint32s {
2174
+ var res Uint32s
2175
+ for i := 0; i < 4; i++ {
2176
+ res.set(i, x.get(i)-y.get(i))
2177
+ }
2178
+ return res
2179
+ }
2180
+
2181
+ // Xor returns the bitwise XOR of x and y.
2182
+ func (x Uint32s) Xor(y Uint32s) Uint32s {
2183
+ return Uint32s{a: x.a ^ y.a, b: x.b ^ y.b}
2184
+ }
2185
+
2186
+ // BitsToFloat32 reinterprets the vector bits as a Float32s vector.
2187
+ func (x Uint32s) BitsToFloat32() Float32s {
2188
+ return Float32s{a: x.a, b: x.b}
2189
+ }
2190
+
2191
+ // BitsToInt32 reinterprets the vector bits as an Int32s vector.
2192
+ func (x Uint32s) BitsToInt32() Int32s {
2193
+ return Int32s{a: x.a, b: x.b}
2194
+ }
2195
+
2196
+ // ConvertToInt32 converts the vector elements to int32.
2197
+ func (x Uint32s) ConvertToInt32() Int32s {
2198
+ return Int32s{a: x.a, b: x.b}
2199
+ }
2200
+
2201
+ // ReshapeToUint16s reinterprets the vector bits as a Uint16s vector.
2202
+ func (x Uint32s) ReshapeToUint16s() Uint16s {
2203
+ return Uint16s{a: x.a, b: x.b}
2204
+ }
2205
+
2206
+ // ReshapeToUint64s reinterprets the vector bits as a Uint64s vector.
2207
+ func (x Uint32s) ReshapeToUint64s() Uint64s {
2208
+ return Uint64s{a: x.a, b: x.b}
2209
+ }
2210
+
2211
+ // ReshapeToUint8s reinterprets the vector bits as a Uint8s vector.
2212
+ func (x Uint32s) ReshapeToUint8s() Uint8s {
2213
+ return Uint8s{a: x.a, b: x.b}
2214
+ }
2215
+
2216
+ // LoadUint64s loads a slice of uint64 into an Uint64s vector.
2217
+ func LoadUint64s(s []uint64) Uint64s {
2218
+ var a, b uint64
2219
+ a = s[0]
2220
+ b = s[1]
2221
+ return Uint64s{a: a, b: b}
2222
+ }
2223
+
2224
+ // LoadUint64sPart loads a partial slice of uint64 into an Uint64s vector.
2225
+ func LoadUint64sPart(s []uint64) (Uint64s, int) {
2226
+ n := len(s)
2227
+ var a, b uint64
2228
+ if n > 0 {
2229
+ a = s[0]
2230
+ }
2231
+ if n > 1 {
2232
+ b = s[1]
2233
+ }
2234
+ return Uint64s{a: a, b: b}, n
2235
+ }
2236
+
2237
+ func (x Uint64s) get(i int) uint64 {
2238
+ if i == 0 {
2239
+ return x.a
2240
+ }
2241
+ return x.b
2242
+ }
2243
+
2244
+ func (x *Uint64s) set(i int, v uint64) {
2245
+ if i == 0 {
2246
+ x.a = v
2247
+ } else {
2248
+ x.b = v
2249
+ }
2250
+ }
2251
+
2252
+ // Add returns the element-wise sum of x and y.
2253
+ func (x Uint64s) Add(y Uint64s) Uint64s {
2254
+ return Uint64s{a: x.a + y.a, b: x.b + y.b}
2255
+ }
2256
+
2257
+ // And returns the bitwise AND of x and y.
2258
+ func (x Uint64s) And(y Uint64s) Uint64s {
2259
+ return Uint64s{a: x.a & y.a, b: x.b & y.b}
2260
+ }
2261
+
2262
+ // AndNot returns the bitwise AND NOT of x and y.
2263
+ func (x Uint64s) AndNot(y Uint64s) Uint64s {
2264
+ return Uint64s{a: x.a &^ y.a, b: x.b &^ y.b}
2265
+ }
2266
+
2267
+ // Equal returns a mask indicating where x and y are equal.
2268
+ func (x Uint64s) Equal(y Uint64s) Mask64s {
2269
+ var res Mask64s
2270
+ if x.a == y.a {
2271
+ res.a = ^uint64(0)
2272
+ }
2273
+ if x.b == y.b {
2274
+ res.b = ^uint64(0)
2275
+ }
2276
+ return res
2277
+ }
2278
+
2279
+ // Greater returns a mask indicating where x is greater than y.
2280
+ func (x Uint64s) Greater(y Uint64s) Mask64s {
2281
+ var res Mask64s
2282
+ for i := 0; i < 2; i++ {
2283
+ if x.get(i) > y.get(i) {
2284
+ res.set(i, true)
2285
+ }
2286
+ }
2287
+ return res
2288
+ }
2289
+
2290
+ // GreaterEqual returns a mask indicating where x is greater than or equal to y.
2291
+ func (x Uint64s) GreaterEqual(y Uint64s) Mask64s {
2292
+ var res Mask64s
2293
+ for i := 0; i < 2; i++ {
2294
+ if x.get(i) >= y.get(i) {
2295
+ res.set(i, true)
2296
+ }
2297
+ }
2298
+ return res
2299
+ }
2300
+
2301
+ // Less returns a mask indicating where x is less than y.
2302
+ func (x Uint64s) Less(y Uint64s) Mask64s {
2303
+ var res Mask64s
2304
+ for i := 0; i < 2; i++ {
2305
+ if x.get(i) < y.get(i) {
2306
+ res.set(i, true)
2307
+ }
2308
+ }
2309
+ return res
2310
+ }
2311
+
2312
+ // LessEqual returns a mask indicating where x is less than or equal to y.
2313
+ func (x Uint64s) LessEqual(y Uint64s) Mask64s {
2314
+ var res Mask64s
2315
+ for i := 0; i < 2; i++ {
2316
+ if x.get(i) <= y.get(i) {
2317
+ res.set(i, true)
2318
+ }
2319
+ }
2320
+ return res
2321
+ }
2322
+
2323
+ // NotEqual returns a mask indicating where x and y are not equal.
2324
+ func (x Uint64s) NotEqual(y Uint64s) Mask64s {
2325
+ var res Mask64s
2326
+ if x.a != y.a {
2327
+ res.a = ^uint64(0)
2328
+ }
2329
+ if x.b != y.b {
2330
+ res.b = ^uint64(0)
2331
+ }
2332
+ return res
2333
+ }
2334
+
2335
+ // Len returns the number of elements in the vector.
2336
+ func (x Uint64s) Len() int {
2337
+ return 2
2338
+ }
2339
+
2340
+ // Masked returns a new vector with elements from x where mask is true, and zero elsewhere.
2341
+ func (x Uint64s) Masked(mask Mask64s) Uint64s {
2342
+ return Uint64s{a: x.a & mask.a, b: x.b & mask.b}
2343
+ }
2344
+
2345
+ // IfElse returns a new vector with elements from x where mask is true, and y where mask is false.
2346
+ func (x Uint64s) IfElse(mask Mask64s, y Uint64s) Uint64s {
2347
+ return Uint64s{
2348
+ a: (x.a & mask.a) | (y.a &^ mask.a),
2349
+ b: (x.b & mask.b) | (y.b &^ mask.b),
2350
+ }
2351
+ }
2352
+
2353
+ // Not returns the bitwise NOT of x.
2354
+ func (x Uint64s) Not() Uint64s {
2355
+ return Uint64s{a: ^x.a, b: ^x.b}
2356
+ }
2357
+
2358
+ // Or returns the bitwise OR of x and y.
2359
+ func (x Uint64s) Or(y Uint64s) Uint64s {
2360
+ return Uint64s{a: x.a | y.a, b: x.b | y.b}
2361
+ }
2362
+
2363
+ // ShiftAllLeft shifts all elements left by y bits.
2364
+ func (x Uint64s) ShiftAllLeft(y uint64) Uint64s {
2365
+ return Uint64s{a: x.a << y, b: x.b << y}
2366
+ }
2367
+
2368
+ // ShiftAllRight shifts all elements right by y bits.
2369
+ func (x Uint64s) ShiftAllRight(y uint64) Uint64s {
2370
+ return Uint64s{a: x.a >> y, b: x.b >> y}
2371
+ }
2372
+
2373
+ // RotateAllLeft rotates all elements left by dist bits.
2374
+ func (x Uint64s) RotateAllLeft(dist uint64) Uint64s {
2375
+ d := dist & 63
2376
+ return Uint64s{
2377
+ a: (x.a << d) | (x.a >> ((64 - d) & 63)),
2378
+ b: (x.b << d) | (x.b >> ((64 - d) & 63)),
2379
+ }
2380
+ }
2381
+
2382
+ // RotateAllRight rotates all elements right by dist bits.
2383
+ func (x Uint64s) RotateAllRight(dist uint64) Uint64s {
2384
+ d := dist & 63
2385
+ return Uint64s{
2386
+ a: (x.a >> d) | (x.a << ((64 - d) & 63)),
2387
+ b: (x.b >> d) | (x.b << ((64 - d) & 63)),
2388
+ }
2389
+ }
2390
+
2391
+ // Store stores the vector elements into the slice s.
2392
+ func (x Uint64s) Store(s []uint64) {
2393
+ if len(s) > 0 {
2394
+ s[0] = x.a
2395
+ }
2396
+ if len(s) > 1 {
2397
+ s[1] = x.b
2398
+ }
2399
+ }
2400
+
2401
+ // StorePart stores a partial vector into the slice s.
2402
+ func (x Uint64s) StorePart(s []uint64) int {
2403
+ x.Store(s)
2404
+ return min(len(s), x.Len())
2405
+ }
2406
+
2407
+ // String returns a string representation of the vector.
2408
+ func (x Uint64s) String() string {
2409
+ return sliceToString([]uint64{x.a, x.b})
2410
+ }
2411
+
2412
+ // Sub returns the element-wise difference of x and y.
2413
+ func (x Uint64s) Sub(y Uint64s) Uint64s {
2414
+ return Uint64s{a: x.a - y.a, b: x.b - y.b}
2415
+ }
2416
+
2417
+ // Xor returns the bitwise XOR of x and y.
2418
+ func (x Uint64s) Xor(y Uint64s) Uint64s {
2419
+ return Uint64s{a: x.a ^ y.a, b: x.b ^ y.b}
2420
+ }
2421
+
2422
+ // BitsToFloat64 reinterprets the vector bits as a Float64s vector.
2423
+ func (x Uint64s) BitsToFloat64() Float64s {
2424
+ return Float64s{a: x.a, b: x.b}
2425
+ }
2426
+
2427
+ // BitsToInt64 reinterprets the vector bits as an Int64s vector.
2428
+ func (x Uint64s) BitsToInt64() Int64s {
2429
+ return Int64s{a: x.a, b: x.b}
2430
+ }
2431
+
2432
+ // ConvertToInt64 converts the vector elements to int64.
2433
+ func (x Uint64s) ConvertToInt64() Int64s {
2434
+ return Int64s{a: x.a, b: x.b}
2435
+ }
2436
+
2437
+ // ReshapeToUint16s reinterprets the vector bits as a Uint16s vector.
2438
+ func (x Uint64s) ReshapeToUint16s() Uint16s {
2439
+ return Uint16s{a: x.a, b: x.b}
2440
+ }
2441
+
2442
+ // ReshapeToUint32s reinterprets the vector bits as a Uint32s vector.
2443
+ func (x Uint64s) ReshapeToUint32s() Uint32s {
2444
+ return Uint32s{a: x.a, b: x.b}
2445
+ }
2446
+
2447
+ // ReshapeToUint8s reinterprets the vector bits as a Uint8s vector.
2448
+ func (x Uint64s) ReshapeToUint8s() Uint8s {
2449
+ return Uint8s{a: x.a, b: x.b}
2450
+ }
2451
+
2452
+ // LoadFloat32s loads a slice of float32 into an Float32s vector.
2453
+ func LoadFloat32s(s []float32) Float32s {
2454
+ var a, b uint64
2455
+ for i := 0; i < 4; i++ {
2456
+ val := uint64(math.Float32bits(s[i]))
2457
+ if i < 2 {
2458
+ a |= val << (32 * i)
2459
+ } else {
2460
+ b |= val << (32 * (i - 2))
2461
+ }
2462
+ }
2463
+ return Float32s{a: a, b: b}
2464
+ }
2465
+
2466
+ // LoadFloat32sPart loads a partial slice of float32 into an Float32s vector.
2467
+ func LoadFloat32sPart(s []float32) (Float32s, int) {
2468
+ var a, b uint64
2469
+ n := len(s)
2470
+ if n > 4 {
2471
+ n = 4
2472
+ }
2473
+ for i := 0; i < n; i++ {
2474
+ val := uint64(math.Float32bits(s[i]))
2475
+ if i < 2 {
2476
+ a |= val << (32 * i)
2477
+ } else {
2478
+ b |= val << (32 * (i - 2))
2479
+ }
2480
+ }
2481
+ return Float32s{a: a, b: b}, n
2482
+ }
2483
+
2484
+ func (x Float32s) get(i int) float32 {
2485
+ if i < 2 {
2486
+ return math.Float32frombits(uint32(x.a >> (32 * i)))
2487
+ }
2488
+ return math.Float32frombits(uint32(x.b >> (32 * (i - 2))))
2489
+ }
2490
+
2491
+ func (x *Float32s) set(i int, v float32) {
2492
+ val := uint64(math.Float32bits(v))
2493
+ if i < 2 {
2494
+ mask := uint64(0xffffffff) << (32 * i)
2495
+ x.a = (x.a &^ mask) | (val << (32 * i))
2496
+ } else {
2497
+ mask := uint64(0xffffffff) << (32 * (i - 2))
2498
+ x.b = (x.b &^ mask) | (val << (32 * (i - 2)))
2499
+ }
2500
+ }
2501
+
2502
+ // Abs returns the element-wise absolute value of x.
2503
+ func (x Float32s) Abs() Float32s {
2504
+ var res Float32s
2505
+ for i := 0; i < 4; i++ {
2506
+ v := x.get(i)
2507
+ if v < 0 {
2508
+ res.set(i, -v)
2509
+ } else {
2510
+ res.set(i, v)
2511
+ }
2512
+ }
2513
+ return res
2514
+ }
2515
+
2516
+ // Add returns the element-wise sum of x and y.
2517
+ func (x Float32s) Add(y Float32s) Float32s {
2518
+ var res Float32s
2519
+ res.set(0, x.get(0)+y.get(0))
2520
+ res.set(1, x.get(1)+y.get(1))
2521
+ res.set(2, x.get(2)+y.get(2))
2522
+ res.set(3, x.get(3)+y.get(3))
2523
+ return res
2524
+ }
2525
+
2526
+ // ConvertToInt32 converts the vector elements to int32.
2527
+ func (x Float32s) ConvertToInt32() Int32s {
2528
+ var res Int32s
2529
+ for i := 0; i < 4; i++ {
2530
+ res.set(i, int32(x.get(i)))
2531
+ }
2532
+ return res
2533
+ }
2534
+
2535
+ // Div returns the element-wise quotient of x and y.
2536
+ func (x Float32s) Div(y Float32s) Float32s {
2537
+ var res Float32s
2538
+ for i := 0; i < 4; i++ {
2539
+ res.set(i, x.get(i)/y.get(i))
2540
+ }
2541
+ return res
2542
+ }
2543
+
2544
+ // Equal returns a mask indicating where x and y are equal.
2545
+ func (x Float32s) Equal(y Float32s) Mask32s {
2546
+ var res Mask32s
2547
+ for i := 0; i < 4; i++ {
2548
+ if x.get(i) == y.get(i) {
2549
+ res.set(i, true)
2550
+ }
2551
+ }
2552
+ return res
2553
+ }
2554
+
2555
+ // Greater returns a mask indicating where x is greater than y.
2556
+ func (x Float32s) Greater(y Float32s) Mask32s {
2557
+ var res Mask32s
2558
+ for i := 0; i < 4; i++ {
2559
+ if x.get(i) > y.get(i) {
2560
+ res.set(i, true)
2561
+ }
2562
+ }
2563
+ return res
2564
+ }
2565
+
2566
+ // GreaterEqual returns a mask indicating where x is greater than or equal to y.
2567
+ func (x Float32s) GreaterEqual(y Float32s) Mask32s {
2568
+ var res Mask32s
2569
+ for i := 0; i < 4; i++ {
2570
+ if x.get(i) >= y.get(i) {
2571
+ res.set(i, true)
2572
+ }
2573
+ }
2574
+ return res
2575
+ }
2576
+
2577
+ // Len returns the number of elements in the vector.
2578
+ func (x Float32s) Len() int {
2579
+ return 4
2580
+ }
2581
+
2582
+ // Less returns a mask indicating where x is less than y.
2583
+ func (x Float32s) Less(y Float32s) Mask32s {
2584
+ var res Mask32s
2585
+ for i := 0; i < 4; i++ {
2586
+ if x.get(i) < y.get(i) {
2587
+ res.set(i, true)
2588
+ }
2589
+ }
2590
+ return res
2591
+ }
2592
+
2593
+ // LessEqual returns a mask indicating where x is less than or equal to y.
2594
+ func (x Float32s) LessEqual(y Float32s) Mask32s {
2595
+ var res Mask32s
2596
+ for i := 0; i < 4; i++ {
2597
+ if x.get(i) <= y.get(i) {
2598
+ res.set(i, true)
2599
+ }
2600
+ }
2601
+ return res
2602
+ }
2603
+
2604
+ // Masked returns a new vector with elements from x where mask is true, and zero elsewhere.
2605
+ func (x Float32s) Masked(mask Mask32s) Float32s {
2606
+ return Float32s{a: x.a & mask.a, b: x.b & mask.b}
2607
+ }
2608
+
2609
+ // Max returns the element-wise maximum of x and y.
2610
+ func (x Float32s) Max(y Float32s) Float32s {
2611
+ var res Float32s
2612
+ for i := 0; i < 4; i++ {
2613
+ vx := x.get(i)
2614
+ vy := y.get(i)
2615
+ if vx > vy {
2616
+ res.set(i, vx)
2617
+ } else {
2618
+ res.set(i, vy)
2619
+ }
2620
+ }
2621
+ return res
2622
+ }
2623
+
2624
+ // IfElse returns a new vector with elements from x where mask is true, and y where mask is false.
2625
+ func (x Float32s) IfElse(mask Mask32s, y Float32s) Float32s {
2626
+ return Float32s{
2627
+ a: (x.a & mask.a) | (y.a &^ mask.a),
2628
+ b: (x.b & mask.b) | (y.b &^ mask.b),
2629
+ }
2630
+ }
2631
+
2632
+ // Min returns the element-wise minimum of x and y.
2633
+ func (x Float32s) Min(y Float32s) Float32s {
2634
+ var res Float32s
2635
+ for i := 0; i < 4; i++ {
2636
+ vx := x.get(i)
2637
+ vy := y.get(i)
2638
+ if vx < vy {
2639
+ res.set(i, vx)
2640
+ } else {
2641
+ res.set(i, vy)
2642
+ }
2643
+ }
2644
+ return res
2645
+ }
2646
+
2647
+ // Mul returns the element-wise product of x and y.
2648
+ func (x Float32s) Mul(y Float32s) Float32s {
2649
+ var res Float32s
2650
+ res.set(0, x.get(0)*y.get(0))
2651
+ res.set(1, x.get(1)*y.get(1))
2652
+ res.set(2, x.get(2)*y.get(2))
2653
+ res.set(3, x.get(3)*y.get(3))
2654
+ return res
2655
+ }
2656
+
2657
+ // MulAdd returns x * y + z element-wise.
2658
+ func (x Float32s) MulAdd(y, z Float32s) Float32s {
2659
+ var res Float32s
2660
+
2661
+ res.set(0, x.get(0)*y.get(0)+z.get(0))
2662
+ res.set(1, x.get(1)*y.get(1)+z.get(1))
2663
+ res.set(2, x.get(2)*y.get(2)+z.get(2))
2664
+ res.set(3, x.get(3)*y.get(3)+z.get(3))
2665
+ return res
2666
+ }
2667
+
2668
+ // Neg returns the element-wise negation of x.
2669
+ func (x Float32s) Neg() Float32s {
2670
+ var res Float32s
2671
+ for i := 0; i < 4; i++ {
2672
+ res.set(i, -(x.get(i)))
2673
+ }
2674
+ return res
2675
+ }
2676
+
2677
+ // NotEqual returns a mask indicating where x and y are not equal.
2678
+ func (x Float32s) NotEqual(y Float32s) Mask32s {
2679
+ var res Mask32s
2680
+ for i := 0; i < 4; i++ {
2681
+ if x.get(i) != y.get(i) {
2682
+ res.set(i, true)
2683
+ }
2684
+ }
2685
+ return res
2686
+ }
2687
+
2688
+ // Sqrt returns the element-wise square root of x.
2689
+ func (x Float32s) Sqrt() Float32s {
2690
+ var res Float32s
2691
+ for i := 0; i < 4; i++ {
2692
+ res.set(i, float32(math.Sqrt(float64(x.get(i)))))
2693
+ }
2694
+ return res
2695
+ }
2696
+
2697
+ // Store stores the vector elements into the slice s.
2698
+ func (x Float32s) Store(s []float32) {
2699
+ for i := 0; i < 4 && i < len(s); i++ {
2700
+ s[i] = x.get(i)
2701
+ }
2702
+ }
2703
+
2704
+ // StorePart stores a partial vector into the slice s.
2705
+ func (x Float32s) StorePart(s []float32) int {
2706
+ x.Store(s)
2707
+ return min(len(s), x.Len())
2708
+ }
2709
+
2710
+ // String returns a string representation of the vector.
2711
+ func (x Float32s) String() string {
2712
+ var parts [4]float32
2713
+ for i := 0; i < 4; i++ {
2714
+ parts[i] = x.get(i)
2715
+ }
2716
+ return sliceToString(parts[:])
2717
+ }
2718
+
2719
+ // Sub returns the element-wise difference of x and y.
2720
+ func (x Float32s) Sub(y Float32s) Float32s {
2721
+ var res Float32s
2722
+ for i := 0; i < 4; i++ {
2723
+ res.set(i, x.get(i)-y.get(i))
2724
+ }
2725
+ return res
2726
+ }
2727
+
2728
+ // ToBits reinterprets the vector bits as a Uint32s vector.
2729
+ func (x Float32s) ToBits() Uint32s {
2730
+ return Uint32s{a: x.a, b: x.b}
2731
+ }
2732
+
2733
+ // LoadFloat64s loads a slice of float64 into an Float64s vector.
2734
+ func LoadFloat64s(s []float64) Float64s {
2735
+ var a, b uint64
2736
+ a = math.Float64bits(s[0])
2737
+ b = math.Float64bits(s[1])
2738
+ return Float64s{a: a, b: b}
2739
+ }
2740
+
2741
+ // LoadFloat64sPart loads a partial slice of float64 into an Float64s vector.
2742
+ func LoadFloat64sPart(s []float64) (Float64s, int) {
2743
+ n := len(s)
2744
+ var a, b uint64
2745
+ if n > 0 {
2746
+ a = math.Float64bits(s[0])
2747
+ }
2748
+ if n > 1 {
2749
+ b = math.Float64bits(s[1])
2750
+ }
2751
+ return Float64s{a: a, b: b}, n
2752
+ }
2753
+
2754
+ func (x Float64s) get(i int) float64 {
2755
+ if i == 0 {
2756
+ return math.Float64frombits(x.a)
2757
+ }
2758
+ return math.Float64frombits(x.b)
2759
+ }
2760
+
2761
+ func (x *Float64s) set(i int, v float64) {
2762
+ if i == 0 {
2763
+ x.a = math.Float64bits(v)
2764
+ } else {
2765
+ x.b = math.Float64bits(v)
2766
+ }
2767
+ }
2768
+
2769
+ // Abs returns the element-wise absolute value of x.
2770
+ func (x Float64s) Abs() Float64s {
2771
+ var res Float64s
2772
+ for i := 0; i < 4; i++ {
2773
+ v := x.get(i)
2774
+ if v < 0 {
2775
+ res.set(i, -v)
2776
+ } else {
2777
+ res.set(i, v)
2778
+ }
2779
+ }
2780
+ return res
2781
+ }
2782
+
2783
+ // Add returns the element-wise sum of x and y.
2784
+ func (x Float64s) Add(y Float64s) Float64s {
2785
+ var res Float64s
2786
+ res.set(0, x.get(0)+y.get(0))
2787
+ res.set(1, x.get(1)+y.get(1))
2788
+ return res
2789
+ }
2790
+
2791
+ // Div returns the element-wise quotient of x and y.
2792
+ func (x Float64s) Div(y Float64s) Float64s {
2793
+ var res Float64s
2794
+ res.set(0, x.get(0)/y.get(0))
2795
+ res.set(1, x.get(1)/y.get(1))
2796
+ return res
2797
+ }
2798
+
2799
+ // Equal returns a mask indicating where x and y are equal.
2800
+ func (x Float64s) Equal(y Float64s) Mask64s {
2801
+ var res Mask64s
2802
+ if x.get(0) == y.get(0) {
2803
+ res.a = ^uint64(0)
2804
+ }
2805
+ if x.get(1) == y.get(1) {
2806
+ res.b = ^uint64(0)
2807
+ }
2808
+ return res
2809
+ }
2810
+
2811
+ // Greater returns a mask indicating where x is greater than y.
2812
+ func (x Float64s) Greater(y Float64s) Mask64s {
2813
+ var res Mask64s
2814
+ if x.get(0) > y.get(0) {
2815
+ res.a = ^uint64(0)
2816
+ }
2817
+ if x.get(1) > y.get(1) {
2818
+ res.b = ^uint64(0)
2819
+ }
2820
+ return res
2821
+ }
2822
+
2823
+ // GreaterEqual returns a mask indicating where x is greater than or equal to y.
2824
+ func (x Float64s) GreaterEqual(y Float64s) Mask64s {
2825
+ var res Mask64s
2826
+ if x.get(0) >= y.get(0) {
2827
+ res.a = ^uint64(0)
2828
+ }
2829
+ if x.get(1) >= y.get(1) {
2830
+ res.b = ^uint64(0)
2831
+ }
2832
+ return res
2833
+ }
2834
+
2835
+ // Len returns the number of elements in the vector.
2836
+ func (x Float64s) Len() int {
2837
+ return 2
2838
+ }
2839
+
2840
+ // Less returns a mask indicating where x is less than y.
2841
+ func (x Float64s) Less(y Float64s) Mask64s {
2842
+ var res Mask64s
2843
+ if x.get(0) < y.get(0) {
2844
+ res.a = ^uint64(0)
2845
+ }
2846
+ if x.get(1) < y.get(1) {
2847
+ res.b = ^uint64(0)
2848
+ }
2849
+ return res
2850
+ }
2851
+
2852
+ // LessEqual returns a mask indicating where x is less than or equal to y.
2853
+ func (x Float64s) LessEqual(y Float64s) Mask64s {
2854
+ var res Mask64s
2855
+ if x.get(0) <= y.get(0) {
2856
+ res.a = ^uint64(0)
2857
+ }
2858
+ if x.get(1) <= y.get(1) {
2859
+ res.b = ^uint64(0)
2860
+ }
2861
+ return res
2862
+ }
2863
+
2864
+ // Masked returns a new vector with elements from x where mask is true, and zero elsewhere.
2865
+ func (x Float64s) Masked(mask Mask64s) Float64s {
2866
+ return Float64s{a: x.a & mask.a, b: x.b & mask.b}
2867
+ }
2868
+
2869
+ // Max returns the element-wise maximum of x and y.
2870
+ func (x Float64s) Max(y Float64s) Float64s {
2871
+ var res Float64s
2872
+ vx := x.get(0)
2873
+ vy := y.get(0)
2874
+ if vx > vy {
2875
+ res.set(0, vx)
2876
+ } else {
2877
+ res.set(0, vy)
2878
+ }
2879
+ vx = x.get(1)
2880
+ vy = y.get(1)
2881
+ if vx > vy {
2882
+ res.set(1, vx)
2883
+ } else {
2884
+ res.set(1, vy)
2885
+ }
2886
+ return res
2887
+ }
2888
+
2889
+ // IfElse returns a new vector with elements from x where mask is true, and y where mask is false.
2890
+ func (x Float64s) IfElse(mask Mask64s, y Float64s) Float64s {
2891
+ return Float64s{
2892
+ a: (x.a & mask.a) | (y.a &^ mask.a),
2893
+ b: (x.b & mask.b) | (y.b &^ mask.b),
2894
+ }
2895
+ }
2896
+
2897
+ // Min returns the element-wise minimum of x and y.
2898
+ func (x Float64s) Min(y Float64s) Float64s {
2899
+ var res Float64s
2900
+ vx := x.get(0)
2901
+ vy := y.get(0)
2902
+ if vx < vy {
2903
+ res.set(0, vx)
2904
+ } else {
2905
+ res.set(0, vy)
2906
+ }
2907
+ vx = x.get(1)
2908
+ vy = y.get(1)
2909
+ if vx < vy {
2910
+ res.set(1, vx)
2911
+ } else {
2912
+ res.set(1, vy)
2913
+ }
2914
+ return res
2915
+ }
2916
+
2917
+ // Mul returns the element-wise product of x and y.
2918
+ func (x Float64s) Mul(y Float64s) Float64s {
2919
+ var res Float64s
2920
+ res.set(0, x.get(0)*y.get(0))
2921
+ res.set(1, x.get(1)*y.get(1))
2922
+ return res
2923
+ }
2924
+
2925
+ // MulAdd returns x * y + z element-wise.
2926
+ func (x Float64s) MulAdd(y, z Float64s) Float64s {
2927
+ var res Float64s
2928
+ res.set(0, x.get(0)*y.get(0)+z.get(0))
2929
+ res.set(1, x.get(1)*y.get(1)+z.get(1))
2930
+ return res
2931
+ }
2932
+
2933
+ // Neg returns the element-wise negation of x.
2934
+ func (x Float64s) Neg() Float64s {
2935
+ var res Float64s
2936
+ for i := 0; i < 4; i++ {
2937
+ res.set(i, -(x.get(i)))
2938
+ }
2939
+ return res
2940
+ }
2941
+
2942
+ // NotEqual returns a mask indicating where x and y are not equal.
2943
+ func (x Float64s) NotEqual(y Float64s) Mask64s {
2944
+ var res Mask64s
2945
+ if x.get(0) != y.get(0) {
2946
+ res.a = ^uint64(0)
2947
+ }
2948
+ if x.get(1) != y.get(1) {
2949
+ res.b = ^uint64(0)
2950
+ }
2951
+ return res
2952
+ }
2953
+
2954
+ // Sqrt returns the element-wise square root of x.
2955
+ func (x Float64s) Sqrt() Float64s {
2956
+ var res Float64s
2957
+ res.set(0, math.Sqrt(x.get(0)))
2958
+ res.set(1, math.Sqrt(x.get(1)))
2959
+ return res
2960
+ }
2961
+
2962
+ // Store stores the vector elements into the slice s.
2963
+ func (x Float64s) Store(s []float64) {
2964
+ if len(s) > 0 {
2965
+ s[0] = x.get(0)
2966
+ }
2967
+ if len(s) > 1 {
2968
+ s[1] = x.get(1)
2969
+ }
2970
+ }
2971
+
2972
+ // StorePart stores a partial vector into the slice s.
2973
+ func (x Float64s) StorePart(s []float64) int {
2974
+ x.Store(s)
2975
+ return min(len(s), x.Len())
2976
+ }
2977
+
2978
+ // String returns a string representation of the vector.
2979
+ func (x Float64s) String() string {
2980
+ return sliceToString([]float64{x.get(0), x.get(1)})
2981
+ }
2982
+
2983
+ // Sub returns the element-wise difference of x and y.
2984
+ func (x Float64s) Sub(y Float64s) Float64s {
2985
+ var res Float64s
2986
+ res.set(0, x.get(0)-y.get(0))
2987
+ res.set(1, x.get(1)-y.get(1))
2988
+ return res
2989
+ }
2990
+
2991
+ // ToBits reinterprets the vector bits as a Uint64s vector.
2992
+ func (x Float64s) ToBits() Uint64s {
2993
+ return Uint64s{a: x.a, b: x.b}
2994
+ }
2995
+
2996
+ func (x *Mask8s) set(i int, v bool) {
2997
+ if v {
2998
+ if i < 8 {
2999
+ mask := uint64(0xff) << (8 * i)
3000
+ x.a |= mask
3001
+ } else {
3002
+ mask := uint64(0xff) << (8 * (i - 8))
3003
+ x.b |= mask
3004
+ }
3005
+ }
3006
+ }
3007
+
3008
+ // And returns the bitwise AND of x and y.
3009
+ func (x Mask8s) And(y Mask8s) Mask8s {
3010
+ return Mask8s{a: x.a & y.a, b: x.b & y.b}
3011
+ }
3012
+
3013
+ // Or returns the bitwise OR of x and y.
3014
+ func (x Mask8s) Or(y Mask8s) Mask8s {
3015
+ return Mask8s{a: x.a | y.a, b: x.b | y.b}
3016
+ }
3017
+
3018
+ // String returns a string representation of the vector.
3019
+ func (x Mask8s) String() string {
3020
+ var s [16]int8
3021
+ x.ToInt8s().Neg().Store(s[:])
3022
+ return sliceToString(s[:])
3023
+ }
3024
+
3025
+ // ToInt8s converts the mask to an Int8s vector.
3026
+ func (x Mask8s) ToInt8s() Int8s {
3027
+ return Int8s{a: x.a, b: x.b}
3028
+ }
3029
+
3030
+ func (x *Mask16s) set(i int, v bool) {
3031
+ if v {
3032
+ if i < 4 {
3033
+ mask := uint64(0xffff) << (16 * i)
3034
+ x.a |= mask
3035
+ } else {
3036
+ mask := uint64(0xffff) << (16 * (i - 4))
3037
+ x.b |= mask
3038
+ }
3039
+ }
3040
+ }
3041
+
3042
+ // And returns the bitwise AND of x and y.
3043
+ func (x Mask16s) And(y Mask16s) Mask16s {
3044
+ return Mask16s{a: x.a & y.a, b: x.b & y.b}
3045
+ }
3046
+
3047
+ // Or returns the bitwise OR of x and y.
3048
+ func (x Mask16s) Or(y Mask16s) Mask16s {
3049
+ return Mask16s{a: x.a | y.a, b: x.b | y.b}
3050
+ }
3051
+
3052
+ // String returns a string representation of the vector.
3053
+ func (x Mask16s) String() string {
3054
+ var s [8]int16
3055
+ x.ToInt16s().Neg().Store(s[:])
3056
+ return sliceToString(s[:])
3057
+ }
3058
+
3059
+ // ToInt16s converts the mask to an Int16s vector.
3060
+ func (x Mask16s) ToInt16s() Int16s {
3061
+ return Int16s{a: x.a, b: x.b}
3062
+ }
3063
+
3064
+ func (x *Mask32s) set(i int, v bool) {
3065
+ if v {
3066
+ if i < 2 {
3067
+ mask := uint64(0xffffffff) << (32 * i)
3068
+ x.a |= mask
3069
+ } else {
3070
+ mask := uint64(0xffffffff) << (32 * (i - 2))
3071
+ x.b |= mask
3072
+ }
3073
+ }
3074
+ }
3075
+
3076
+ // And returns the bitwise AND of x and y.
3077
+ func (x Mask32s) And(y Mask32s) Mask32s {
3078
+ return Mask32s{a: x.a & y.a, b: x.b & y.b}
3079
+ }
3080
+
3081
+ // Or returns the bitwise OR of x and y.
3082
+ func (x Mask32s) Or(y Mask32s) Mask32s {
3083
+ return Mask32s{a: x.a | y.a, b: x.b | y.b}
3084
+ }
3085
+
3086
+ // String returns a string representation of the vector.
3087
+ func (x Mask32s) String() string {
3088
+ var s [4]int32
3089
+ x.ToInt32s().Neg().Store(s[:])
3090
+ return sliceToString(s[:])
3091
+ }
3092
+
3093
+ // ToInt32s converts the mask to an Int32s vector.
3094
+ func (x Mask32s) ToInt32s() Int32s {
3095
+ return Int32s{a: x.a, b: x.b}
3096
+ }
3097
+
3098
+ func (x *Mask64s) set(i int, v bool) {
3099
+ if v {
3100
+ if i == 0 {
3101
+ x.a = ^uint64(0)
3102
+ } else {
3103
+ x.b = ^uint64(0)
3104
+ }
3105
+ }
3106
+ }
3107
+
3108
+ // And returns the bitwise AND of x and y.
3109
+ func (x Mask64s) And(y Mask64s) Mask64s {
3110
+ return Mask64s{a: x.a & y.a, b: x.b & y.b}
3111
+ }
3112
+
3113
+ // Or returns the bitwise OR of x and y.
3114
+ func (x Mask64s) Or(y Mask64s) Mask64s {
3115
+ return Mask64s{a: x.a | y.a, b: x.b | y.b}
3116
+ }
3117
+
3118
+ // String returns a string representation of the vector.
3119
+ func (x Mask64s) String() string {
3120
+ var s [2]int64
3121
+ x.ToInt64s().Neg().Store(s[:])
3122
+ return sliceToString(s[:])
3123
+ }
3124
+
3125
+ // ToInt64s converts the mask to an Int64s vector.
3126
+ func (x Mask64s) ToInt64s() Int64s {
3127
+ return Int64s{a: x.a, b: x.b}
3128
+ }
3129
+
3130
+ func newT(lo, hi uint64) Uint64s {
3131
+ return Uint64s{a: lo, b: hi}
3132
+ }
3133
+
3134
+ // mwl returns the 128-bit product of the lower halves of x and y
3135
+ func (x Uint64s) mwl(y Uint64s) Uint64s {
3136
+ hi, lo := bits.Mul64(x.a, y.a)
3137
+ return Uint64s{a: lo, b: hi}
3138
+ }
3139
+
3140
+ var (
3141
+ // For mK, bits J such that J mod 5 == K are set
3142
+ m0 = newT(0x1084210842108421, 0x2108421084210842)
3143
+ m1 = newT(0x2108421084210842, 0x4210842108421084)
3144
+ m2 = newT(0x4210842108421084, 0x8421084210842108)
3145
+ m3 = newT(0x8421084210842108, 0x0842108421084210)
3146
+ m4 = newT(0x0842108421084210, 0x1084210842108421)
3147
+ )
3148
+
3149
+ func (x Uint64s) clmul(y Uint64s) Uint64s {
3150
+ x0 := x.And(m0)
3151
+ x1 := x.And(m1)
3152
+ x2 := x.And(m2)
3153
+ x3 := x.And(m3)
3154
+ x4 := x.And(m4)
3155
+
3156
+ y0 := y.And(m0)
3157
+ y1 := y.And(m1)
3158
+ y2 := y.And(m2)
3159
+ y3 := y.And(m3)
3160
+ y4 := y.And(m4)
3161
+
3162
+ // sum of x, y indices == K mod 5; mask index = K
3163
+ z := (x0.mwl(y0)).Xor(x1.mwl(y4)).Xor(x4.mwl(y1)).Xor(x2.mwl(y3)).Xor(x3.mwl(y2)).And(m0)
3164
+ z = (x3.mwl(y3)).Xor(x2.mwl(y4)).Xor(x4.mwl(y2)).Xor(x0.mwl(y1)).Xor(x1.mwl(y0)).And(m1).Or(z)
3165
+ z = (x1.mwl(y1)).Xor(x3.mwl(y4)).Xor(x4.mwl(y3)).Xor(x0.mwl(y2)).Xor(x2.mwl(y0)).And(m2).Or(z)
3166
+ z = (x4.mwl(y4)).Xor(x0.mwl(y3)).Xor(x3.mwl(y0)).Xor(x1.mwl(y2)).Xor(x2.mwl(y1)).And(m3).Or(z)
3167
+ z = (x2.mwl(y2)).Xor(x0.mwl(y4)).Xor(x4.mwl(y0)).Xor(x1.mwl(y3)).Xor(x3.mwl(y1)).And(m4).Or(z)
3168
+
3169
+ return z
3170
+ }
3171
+
3172
+ // CarrylessMultiplyEven computes the carryless
3173
+ // multiplications of selected even halves of the elements of x and y.
3174
+ // The result fills the 128 bits of each even-odd pair.
3175
+ //
3176
+ // A carryless multiplication uses bitwise XOR instead of
3177
+ // add-with-carry, for example (in base two):
3178
+ //
3179
+ // 11 * 11 = 11 * (10 ^ 1) = (11 * 10) ^ (11 * 1) = 110 ^ 11 = 101
3180
+ //
3181
+ // This also models multiplication of polynomials with coefficients
3182
+ // from GF(2) -- 11 * 11 models (x+1)*(x+1) = x**2 + (1^1)x + 1 =
3183
+ // x**2 + 0x + 1 = x**2 + 1 modeled by 101. (Note that "+" adds
3184
+ // polynomial terms, but coefficients "add" with XOR.)
3185
+ func (x Uint64s) CarrylessMultiplyEven(y Uint64s) Uint64s {
3186
+ return x.clmul(y)
3187
+ }
3188
+
3189
+ // CarrylessMultiplyOdd computes the carryless
3190
+ // multiplications of selected odd halves of the elements of x and y.
3191
+ // The result fills the 128 bits of each even-odd pair.
3192
+ //
3193
+ // A carryless multiplication uses bitwise XOR instead of
3194
+ // add-with-carry, for example (in base two):
3195
+ //
3196
+ // 11 * 11 = 11 * (10 ^ 1) = (11 * 10) ^ (11 * 1) = 110 ^ 11 = 101
3197
+ //
3198
+ // This also models multiplication of polynomials with coefficients
3199
+ // from GF(2) -- 11 * 11 models (x+1)*(x+1) = x**2 + (1^1)x + 1 =
3200
+ // x**2 + 0x + 1 = x**2 + 1 modeled by 101. (Note that "+" adds
3201
+ // polynomial terms, but coefficients "add" with XOR.)
3202
+ func (x Uint64s) CarrylessMultiplyOdd(y Uint64s) Uint64s {
3203
+ x.a = x.b
3204
+ y.a = y.b
3205
+ return x.clmul(y)
3206
+ }
3207
+
3208
+ const (
3209
+ by8 = 0x0101010101010101
3210
+ by16 = 0x0001000100010001
3211
+ )
3212
+
3213
+ // BroadcastInt8 fills the elements of a slice with its argument value.
3214
+ func BroadcastInt8s(x int8) Int8s {
3215
+ v := (255 & uint64(x)) * by8
3216
+ return Int8s{a: v, b: v}
3217
+ }
3218
+
3219
+ // BroadcastInt16 fills the elements of a slice with its argument value.
3220
+ func BroadcastInt16s(x int16) Int16s {
3221
+ v := (65535 & uint64(x)) * by16
3222
+ return Int16s{a: v, b: v}
3223
+ }
3224
+
3225
+ // BroadcastInt32 fills the elements of a slice with its argument value.
3226
+ func BroadcastInt32s(x int32) Int32s {
3227
+ v := uint64(x) & 0xffffffff
3228
+ v = v<<32 | v
3229
+ return Int32s{a: v, b: v}
3230
+ }
3231
+
3232
+ // BroadcastInt64 fills the elements of a slice with its argument value.
3233
+ func BroadcastInt64s(x int64) Int64s {
3234
+ v := uint64(x)
3235
+ return Int64s{a: v, b: v}
3236
+ }
3237
+
3238
+ // BroadcastUint8 fills the elements of a slice with its argument value.
3239
+ func BroadcastUint8s(x uint8) Uint8s {
3240
+ v := uint64(x) * by8
3241
+ return Uint8s{a: v, b: v}
3242
+
3243
+ }
3244
+
3245
+ // BroadcastUint16 fills the elements of a slice with its argument value.
3246
+ func BroadcastUint16s(x uint16) Uint16s {
3247
+ v := uint64(x) * by16
3248
+ return Uint16s{a: v, b: v}
3249
+
3250
+ }
3251
+
3252
+ // BroadcastUint32 fills the elements of a slice with its argument value.
3253
+ func BroadcastUint32s(x uint32) Uint32s {
3254
+ v := uint64(x)
3255
+ v = v<<32 | v
3256
+ return Uint32s{a: v, b: v}
3257
+ }
3258
+
3259
+ // BroadcastUint64 fills the elements of a slice with its argument value.
3260
+ func BroadcastUint64s(x uint64) Uint64s {
3261
+ return Uint64s{a: x, b: x}
3262
+ }
3263
+
3264
+ // BroadcastFloat32 fills the elements of a slice with its argument value.
3265
+ func BroadcastFloat32s(x float32) Float32s {
3266
+ v := uint64(math.Float32bits(x))
3267
+ v = v<<32 | v
3268
+ return Float32s{a: v, b: v}
3269
+ }
3270
+
3271
+ // BroadcastFloat64 fills the elements of a slice with its argument value.
3272
+ func BroadcastFloat64s(x float64) Float64s {
3273
+ v := math.Float64bits(x)
3274
+ return Float64s{a: v, b: v}
3275
+ }