| // Copyright 2019 The Go Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style |
| // license that can be found in the LICENSE file. |
| // Generic fallbacks for the math/bits intrinsics, copied from |
| // src/math/bits/bits.go. They were added in Go 1.12, but Add64 and Sum64 had |
| // variable time fallbacks until Go 1.13. |
| func bitsAdd64(x, y, carry uint64) (sum, carryOut uint64) { |
| carryOut = ((x & y) | ((x | y) &^ sum)) >> 63 |
| func bitsSub64(x, y, borrow uint64) (diff, borrowOut uint64) { |
| borrowOut = ((^x & y) | (^(x ^ y) & diff)) >> 63 |
| func bitsMul64(x, y uint64) (hi, lo uint64) { |