// Copyright 2023 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. // TODO(61395): move these tests to atomic_test.go once And/Or have // implementations for all architectures. package atomic_test import ( "runtime/internal/atomic" "testing" ) func TestAnd32(t *testing.T) { // Basic sanity check. x := uint32(0xffffffff) for i := uint32(0); i < 32; i++ { old := x v := atomic.And32(&x, ^(1 << i)) if r := uint32(0xffffffff) << (i + 1); x != r || v != old { t.Fatalf("clearing bit %#x: want %#x, got new %#x and old %#v", uint32(1<