ints: Pull types into independent files

In anticipation of automatically generating these definitions, pull the
definitions of the various integer types into their own files as well as
their tests.

This will make it easier to review the changes when each of these files
is generated independently and automatically.
diff --git a/atomic.go b/atomic.go
index fe17478..0a0bba5 100644
--- a/atomic.go
+++ b/atomic.go
@@ -29,258 +29,6 @@
 	"time"
 )
 
-// Int32 is an atomic wrapper around an int32.
-type Int32 struct{ v int32 }
-
-// NewInt32 creates an Int32.
-func NewInt32(i int32) *Int32 {
-	return &Int32{i}
-}
-
-// Load atomically loads the wrapped value.
-func (i *Int32) Load() int32 {
-	return atomic.LoadInt32(&i.v)
-}
-
-// Add atomically adds to the wrapped int32 and returns the new value.
-func (i *Int32) Add(n int32) int32 {
-	return atomic.AddInt32(&i.v, n)
-}
-
-// Sub atomically subtracts from the wrapped int32 and returns the new value.
-func (i *Int32) Sub(n int32) int32 {
-	return atomic.AddInt32(&i.v, -n)
-}
-
-// Inc atomically increments the wrapped int32 and returns the new value.
-func (i *Int32) Inc() int32 {
-	return i.Add(1)
-}
-
-// Dec atomically decrements the wrapped int32 and returns the new value.
-func (i *Int32) Dec() int32 {
-	return i.Sub(1)
-}
-
-// CAS is an atomic compare-and-swap.
-func (i *Int32) CAS(old, new int32) bool {
-	return atomic.CompareAndSwapInt32(&i.v, old, new)
-}
-
-// Store atomically stores the passed value.
-func (i *Int32) Store(n int32) {
-	atomic.StoreInt32(&i.v, n)
-}
-
-// Swap atomically swaps the wrapped int32 and returns the old value.
-func (i *Int32) Swap(n int32) int32 {
-	return atomic.SwapInt32(&i.v, n)
-}
-
-// MarshalJSON encodes the wrapped int32 into JSON.
-func (i *Int32) MarshalJSON() ([]byte, error) {
-	return json.Marshal(i.Load())
-}
-
-// UnmarshalJSON decodes JSON into the wrapped int32.
-func (i *Int32) UnmarshalJSON(b []byte) error {
-	var v int32
-	if err := json.Unmarshal(b, &v); err != nil {
-		return err
-	}
-	i.Store(v)
-	return nil
-}
-
-// Int64 is an atomic wrapper around an int64.
-type Int64 struct{ v int64 }
-
-// NewInt64 creates an Int64.
-func NewInt64(i int64) *Int64 {
-	return &Int64{i}
-}
-
-// Load atomically loads the wrapped value.
-func (i *Int64) Load() int64 {
-	return atomic.LoadInt64(&i.v)
-}
-
-// Add atomically adds to the wrapped int64 and returns the new value.
-func (i *Int64) Add(n int64) int64 {
-	return atomic.AddInt64(&i.v, n)
-}
-
-// Sub atomically subtracts from the wrapped int64 and returns the new value.
-func (i *Int64) Sub(n int64) int64 {
-	return atomic.AddInt64(&i.v, -n)
-}
-
-// Inc atomically increments the wrapped int64 and returns the new value.
-func (i *Int64) Inc() int64 {
-	return i.Add(1)
-}
-
-// Dec atomically decrements the wrapped int64 and returns the new value.
-func (i *Int64) Dec() int64 {
-	return i.Sub(1)
-}
-
-// CAS is an atomic compare-and-swap.
-func (i *Int64) CAS(old, new int64) bool {
-	return atomic.CompareAndSwapInt64(&i.v, old, new)
-}
-
-// Store atomically stores the passed value.
-func (i *Int64) Store(n int64) {
-	atomic.StoreInt64(&i.v, n)
-}
-
-// Swap atomically swaps the wrapped int64 and returns the old value.
-func (i *Int64) Swap(n int64) int64 {
-	return atomic.SwapInt64(&i.v, n)
-}
-
-// MarshalJSON encodes the wrapped int64 into JSON.
-func (i *Int64) MarshalJSON() ([]byte, error) {
-	return json.Marshal(i.Load())
-}
-
-// UnmarshalJSON decodes JSON into the wrapped int64.
-func (i *Int64) UnmarshalJSON(b []byte) error {
-	var v int64
-	if err := json.Unmarshal(b, &v); err != nil {
-		return err
-	}
-	i.Store(v)
-	return nil
-}
-
-// Uint32 is an atomic wrapper around an uint32.
-type Uint32 struct{ v uint32 }
-
-// NewUint32 creates a Uint32.
-func NewUint32(i uint32) *Uint32 {
-	return &Uint32{i}
-}
-
-// Load atomically loads the wrapped value.
-func (i *Uint32) Load() uint32 {
-	return atomic.LoadUint32(&i.v)
-}
-
-// Add atomically adds to the wrapped uint32 and returns the new value.
-func (i *Uint32) Add(n uint32) uint32 {
-	return atomic.AddUint32(&i.v, n)
-}
-
-// Sub atomically subtracts from the wrapped uint32 and returns the new value.
-func (i *Uint32) Sub(n uint32) uint32 {
-	return atomic.AddUint32(&i.v, ^(n - 1))
-}
-
-// Inc atomically increments the wrapped uint32 and returns the new value.
-func (i *Uint32) Inc() uint32 {
-	return i.Add(1)
-}
-
-// Dec atomically decrements the wrapped int32 and returns the new value.
-func (i *Uint32) Dec() uint32 {
-	return i.Sub(1)
-}
-
-// CAS is an atomic compare-and-swap.
-func (i *Uint32) CAS(old, new uint32) bool {
-	return atomic.CompareAndSwapUint32(&i.v, old, new)
-}
-
-// Store atomically stores the passed value.
-func (i *Uint32) Store(n uint32) {
-	atomic.StoreUint32(&i.v, n)
-}
-
-// Swap atomically swaps the wrapped uint32 and returns the old value.
-func (i *Uint32) Swap(n uint32) uint32 {
-	return atomic.SwapUint32(&i.v, n)
-}
-
-// MarshalJSON encodes the wrapped uint32 into JSON.
-func (i *Uint32) MarshalJSON() ([]byte, error) {
-	return json.Marshal(i.Load())
-}
-
-// UnmarshalJSON decodes JSON into the wrapped uint32.
-func (i *Uint32) UnmarshalJSON(b []byte) error {
-	var v uint32
-	if err := json.Unmarshal(b, &v); err != nil {
-		return err
-	}
-	i.Store(v)
-	return nil
-}
-
-// Uint64 is an atomic wrapper around a uint64.
-type Uint64 struct{ v uint64 }
-
-// NewUint64 creates a Uint64.
-func NewUint64(i uint64) *Uint64 {
-	return &Uint64{i}
-}
-
-// Load atomically loads the wrapped value.
-func (i *Uint64) Load() uint64 {
-	return atomic.LoadUint64(&i.v)
-}
-
-// Add atomically adds to the wrapped uint64 and returns the new value.
-func (i *Uint64) Add(n uint64) uint64 {
-	return atomic.AddUint64(&i.v, n)
-}
-
-// Sub atomically subtracts from the wrapped uint64 and returns the new value.
-func (i *Uint64) Sub(n uint64) uint64 {
-	return atomic.AddUint64(&i.v, ^(n - 1))
-}
-
-// Inc atomically increments the wrapped uint64 and returns the new value.
-func (i *Uint64) Inc() uint64 {
-	return i.Add(1)
-}
-
-// Dec atomically decrements the wrapped uint64 and returns the new value.
-func (i *Uint64) Dec() uint64 {
-	return i.Sub(1)
-}
-
-// CAS is an atomic compare-and-swap.
-func (i *Uint64) CAS(old, new uint64) bool {
-	return atomic.CompareAndSwapUint64(&i.v, old, new)
-}
-
-// Store atomically stores the passed value.
-func (i *Uint64) Store(n uint64) {
-	atomic.StoreUint64(&i.v, n)
-}
-
-// Swap atomically swaps the wrapped uint64 and returns the old value.
-func (i *Uint64) Swap(n uint64) uint64 {
-	return atomic.SwapUint64(&i.v, n)
-}
-
-// MarshalJSON encodes the wrapped uint64 into JSON.
-func (i *Uint64) MarshalJSON() ([]byte, error) {
-	return json.Marshal(i.Load())
-}
-
-// UnmarshalJSON decodes JSON into the wrapped uint64.
-func (i *Uint64) UnmarshalJSON(b []byte) error {
-	var v uint64
-	if err := json.Unmarshal(b, &v); err != nil {
-		return err
-	}
-	i.Store(v)
-	return nil
-}
-
 // Bool is an atomic Boolean.
 type Bool struct{ v uint32 }
 
diff --git a/atomic_test.go b/atomic_test.go
index 41c4ab4..b57d197 100644
--- a/atomic_test.go
+++ b/atomic_test.go
@@ -29,158 +29,6 @@
 	"github.com/stretchr/testify/require"
 )
 
-func TestInt32(t *testing.T) {
-	atom := NewInt32(42)
-
-	require.Equal(t, int32(42), atom.Load(), "Load didn't work.")
-	require.Equal(t, int32(46), atom.Add(4), "Add didn't work.")
-	require.Equal(t, int32(44), atom.Sub(2), "Sub didn't work.")
-	require.Equal(t, int32(45), atom.Inc(), "Inc didn't work.")
-	require.Equal(t, int32(44), atom.Dec(), "Dec didn't work.")
-
-	require.True(t, atom.CAS(44, 0), "CAS didn't report a swap.")
-	require.Equal(t, int32(0), atom.Load(), "CAS didn't set the correct value.")
-
-	require.Equal(t, int32(0), atom.Swap(1), "Swap didn't return the old value.")
-	require.Equal(t, int32(1), atom.Load(), "Swap didn't set the correct value.")
-
-	atom.Store(42)
-	require.Equal(t, int32(42), atom.Load(), "Store didn't set the correct value.")
-
-	t.Run("JSON/Marshal", func(t *testing.T) {
-		bytes, err := json.Marshal(atom)
-		require.NoError(t, err, "json.Marshal errored unexpectedly.")
-		require.Equal(t, []byte("42"), bytes, "json.Marshal encoded the wrong bytes.")
-	})
-
-	t.Run("JSON/Unmarshal", func(t *testing.T) {
-		err := json.Unmarshal([]byte("40"), &atom)
-		require.NoError(t, err, "json.Unmarshal errored unexpectedly.")
-		require.Equal(t, int32(40), atom.Load(), "json.Unmarshal didn't set the correct value.")
-	})
-
-	t.Run("JSON/Unmarshal/Error", func(t *testing.T) {
-		err := json.Unmarshal([]byte(`"40"`), &atom)
-		require.Error(t, err, "json.Unmarshal didn't error as expected.")
-		assertErrorJSONUnmarshalType(t, err,
-			"json.Unmarshal failed with unexpected error %v, want UnmarshalTypeError.", err)
-	})
-}
-
-func TestInt64(t *testing.T) {
-	atom := NewInt64(42)
-
-	require.Equal(t, int64(42), atom.Load(), "Load didn't work.")
-	require.Equal(t, int64(46), atom.Add(4), "Add didn't work.")
-	require.Equal(t, int64(44), atom.Sub(2), "Sub didn't work.")
-	require.Equal(t, int64(45), atom.Inc(), "Inc didn't work.")
-	require.Equal(t, int64(44), atom.Dec(), "Dec didn't work.")
-
-	require.True(t, atom.CAS(44, 0), "CAS didn't report a swap.")
-	require.Equal(t, int64(0), atom.Load(), "CAS didn't set the correct value.")
-
-	require.Equal(t, int64(0), atom.Swap(1), "Swap didn't return the old value.")
-	require.Equal(t, int64(1), atom.Load(), "Swap didn't set the correct value.")
-
-	atom.Store(42)
-	require.Equal(t, int64(42), atom.Load(), "Store didn't set the correct value.")
-
-	t.Run("JSON/Marshal", func(t *testing.T) {
-		bytes, err := json.Marshal(atom)
-		require.NoError(t, err, "json.Marshal errored unexpectedly.")
-		require.Equal(t, []byte("42"), bytes, "json.Marshal encoded the wrong bytes.")
-	})
-
-	t.Run("JSON/Unmarshal", func(t *testing.T) {
-		err := json.Unmarshal([]byte("40"), &atom)
-		require.NoError(t, err, "json.Unmarshal errored unexpectedly.")
-		require.Equal(t, int64(40), atom.Load(), "json.Unmarshal didn't set the correct value.")
-	})
-
-	t.Run("JSON/Unmarshal/Error", func(t *testing.T) {
-		err := json.Unmarshal([]byte(`"40"`), &atom)
-		require.Error(t, err, "json.Unmarshal didn't error as expected.")
-		assertErrorJSONUnmarshalType(t, err,
-			"json.Unmarshal failed with unexpected error %v, want UnmarshalTypeError.", err)
-	})
-}
-
-func TestUint32(t *testing.T) {
-	atom := NewUint32(42)
-
-	require.Equal(t, uint32(42), atom.Load(), "Load didn't work.")
-	require.Equal(t, uint32(46), atom.Add(4), "Add didn't work.")
-	require.Equal(t, uint32(44), atom.Sub(2), "Sub didn't work.")
-	require.Equal(t, uint32(45), atom.Inc(), "Inc didn't work.")
-	require.Equal(t, uint32(44), atom.Dec(), "Dec didn't work.")
-
-	require.True(t, atom.CAS(44, 0), "CAS didn't report a swap.")
-	require.Equal(t, uint32(0), atom.Load(), "CAS didn't set the correct value.")
-
-	require.Equal(t, uint32(0), atom.Swap(1), "Swap didn't return the old value.")
-	require.Equal(t, uint32(1), atom.Load(), "Swap didn't set the correct value.")
-
-	atom.Store(42)
-	require.Equal(t, uint32(42), atom.Load(), "Store didn't set the correct value.")
-
-	t.Run("JSON/Marshal", func(t *testing.T) {
-		bytes, err := json.Marshal(atom)
-		require.NoError(t, err, "json.Marshal errored unexpectedly.")
-		require.Equal(t, []byte("42"), bytes, "json.Marshal encoded the wrong bytes.")
-	})
-
-	t.Run("JSON/Unmarshal", func(t *testing.T) {
-		err := json.Unmarshal([]byte("40"), &atom)
-		require.NoError(t, err, "json.Unmarshal errored unexpectedly.")
-		require.Equal(t, uint32(40), atom.Load(), "json.Unmarshal didn't set the correct value.")
-	})
-
-	t.Run("JSON/Unmarshal/Error", func(t *testing.T) {
-		err := json.Unmarshal([]byte(`"40"`), &atom)
-		require.Error(t, err, "json.Unmarshal didn't error as expected.")
-		assertErrorJSONUnmarshalType(t, err,
-			"json.Unmarshal failed with unexpected error %v, want UnmarshalTypeError.", err)
-	})
-}
-
-func TestUint64(t *testing.T) {
-	atom := NewUint64(42)
-
-	require.Equal(t, uint64(42), atom.Load(), "Load didn't work.")
-	require.Equal(t, uint64(46), atom.Add(4), "Add didn't work.")
-	require.Equal(t, uint64(44), atom.Sub(2), "Sub didn't work.")
-	require.Equal(t, uint64(45), atom.Inc(), "Inc didn't work.")
-	require.Equal(t, uint64(44), atom.Dec(), "Dec didn't work.")
-
-	require.True(t, atom.CAS(44, 0), "CAS didn't report a swap.")
-	require.Equal(t, uint64(0), atom.Load(), "CAS didn't set the correct value.")
-
-	require.Equal(t, uint64(0), atom.Swap(1), "Swap didn't return the old value.")
-	require.Equal(t, uint64(1), atom.Load(), "Swap didn't set the correct value.")
-
-	atom.Store(42)
-	require.Equal(t, uint64(42), atom.Load(), "Store didn't set the correct value.")
-
-	t.Run("JSON/Marshal", func(t *testing.T) {
-		bytes, err := json.Marshal(atom)
-		require.NoError(t, err, "json.Marshal errored unexpectedly.")
-		require.Equal(t, []byte("42"), bytes, "json.Marshal encoded the wrong bytes.")
-	})
-
-	t.Run("JSON/Unmarshal", func(t *testing.T) {
-		err := json.Unmarshal([]byte("40"), &atom)
-		require.NoError(t, err, "json.Unmarshal errored unexpectedly.")
-		require.Equal(t, uint64(40), atom.Load(), "json.Unmarshal didn't set the correct value.")
-	})
-
-	t.Run("JSON/Unmarshal/Error", func(t *testing.T) {
-		err := json.Unmarshal([]byte(`"40"`), &atom)
-		require.Error(t, err, "json.Unmarshal didn't error as expected.")
-		assertErrorJSONUnmarshalType(t, err,
-			"json.Unmarshal failed with unexpected error %v, want UnmarshalTypeError.", err)
-	})
-}
-
 func TestBool(t *testing.T) {
 	atom := NewBool(false)
 	require.False(t, atom.Toggle(), "Expected Toggle to return previous value.")
@@ -253,7 +101,7 @@
 	})
 
 	t.Run("JSON/Unmarshal/Error", func(t *testing.T) {
-		err := json.Unmarshal([]byte(`"40.5"`), &atom)
+		err := json.Unmarshal([]byte("\"40.5\""), &atom)
 		require.Error(t, err, "json.Unmarshal didn't error as expected.")
 		assertErrorJSONUnmarshalType(t, err,
 			"json.Unmarshal failed with unexpected error %v, want UnmarshalTypeError.", err)
@@ -290,7 +138,7 @@
 	})
 
 	t.Run("JSON/Unmarshal/Error", func(t *testing.T) {
-		err := json.Unmarshal([]byte(`"1000000000"`), &atom)
+		err := json.Unmarshal([]byte("\"1000000000\""), &atom)
 		require.Error(t, err, "json.Unmarshal didn't error as expected.")
 		assertErrorJSONUnmarshalType(t, err,
 			"json.Unmarshal failed with unexpected error %v, want UnmarshalTypeError.", err)
diff --git a/int32.go b/int32.go
new file mode 100644
index 0000000..d31191e
--- /dev/null
+++ b/int32.go
@@ -0,0 +1,89 @@
+// Copyright (c) 2020 Uber Technologies, Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+package atomic
+
+import (
+	"encoding/json"
+	"sync/atomic"
+)
+
+// Int32 is an atomic wrapper around an int32.
+type Int32 struct{ v int32 }
+
+// NewInt32 creates an Int32.
+func NewInt32(i int32) *Int32 {
+	return &Int32{i}
+}
+
+// Load atomically loads the wrapped value.
+func (i *Int32) Load() int32 {
+	return atomic.LoadInt32(&i.v)
+}
+
+// Add atomically adds to the wrapped int32 and returns the new value.
+func (i *Int32) Add(n int32) int32 {
+	return atomic.AddInt32(&i.v, n)
+}
+
+// Sub atomically subtracts from the wrapped int32 and returns the new value.
+func (i *Int32) Sub(n int32) int32 {
+	return atomic.AddInt32(&i.v, -n)
+}
+
+// Inc atomically increments the wrapped int32 and returns the new value.
+func (i *Int32) Inc() int32 {
+	return i.Add(1)
+}
+
+// Dec atomically decrements the wrapped int32 and returns the new value.
+func (i *Int32) Dec() int32 {
+	return i.Sub(1)
+}
+
+// CAS is an atomic compare-and-swap.
+func (i *Int32) CAS(old, new int32) bool {
+	return atomic.CompareAndSwapInt32(&i.v, old, new)
+}
+
+// Store atomically stores the passed value.
+func (i *Int32) Store(n int32) {
+	atomic.StoreInt32(&i.v, n)
+}
+
+// Swap atomically swaps the wrapped int32 and returns the old value.
+func (i *Int32) Swap(n int32) int32 {
+	return atomic.SwapInt32(&i.v, n)
+}
+
+// MarshalJSON encodes the wrapped int32 into JSON.
+func (i *Int32) MarshalJSON() ([]byte, error) {
+	return json.Marshal(i.Load())
+}
+
+// UnmarshalJSON decodes JSON into the wrapped int32.
+func (i *Int32) UnmarshalJSON(b []byte) error {
+	var v int32
+	if err := json.Unmarshal(b, &v); err != nil {
+		return err
+	}
+	i.Store(v)
+	return nil
+}
diff --git a/int32_test.go b/int32_test.go
new file mode 100644
index 0000000..19c9ef7
--- /dev/null
+++ b/int32_test.go
@@ -0,0 +1,66 @@
+// Copyright (c) 2020 Uber Technologies, Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+package atomic
+
+import (
+	"encoding/json"
+	"testing"
+
+	"github.com/stretchr/testify/require"
+)
+
+func TestInt32(t *testing.T) {
+	atom := NewInt32(42)
+
+	require.Equal(t, int32(42), atom.Load(), "Load didn't work.")
+	require.Equal(t, int32(46), atom.Add(4), "Add didn't work.")
+	require.Equal(t, int32(44), atom.Sub(2), "Sub didn't work.")
+	require.Equal(t, int32(45), atom.Inc(), "Inc didn't work.")
+	require.Equal(t, int32(44), atom.Dec(), "Dec didn't work.")
+
+	require.True(t, atom.CAS(44, 0), "CAS didn't report a swap.")
+	require.Equal(t, int32(0), atom.Load(), "CAS didn't set the correct value.")
+
+	require.Equal(t, int32(0), atom.Swap(1), "Swap didn't return the old value.")
+	require.Equal(t, int32(1), atom.Load(), "Swap didn't set the correct value.")
+
+	atom.Store(42)
+	require.Equal(t, int32(42), atom.Load(), "Store didn't set the correct value.")
+
+	t.Run("JSON/Marshal", func(t *testing.T) {
+		bytes, err := json.Marshal(atom)
+		require.NoError(t, err, "json.Marshal errored unexpectedly.")
+		require.Equal(t, []byte("42"), bytes, "json.Marshal encoded the wrong bytes.")
+	})
+
+	t.Run("JSON/Unmarshal", func(t *testing.T) {
+		err := json.Unmarshal([]byte("40"), &atom)
+		require.NoError(t, err, "json.Unmarshal errored unexpectedly.")
+		require.Equal(t, int32(40), atom.Load(), "json.Unmarshal didn't set the correct value.")
+	})
+
+	t.Run("JSON/Unmarshal/Error", func(t *testing.T) {
+		err := json.Unmarshal([]byte(`"40"`), &atom)
+		require.Error(t, err, "json.Unmarshal didn't error as expected.")
+		assertErrorJSONUnmarshalType(t, err,
+			"json.Unmarshal failed with unexpected error %v, want UnmarshalTypeError.", err)
+	})
+}
diff --git a/int64.go b/int64.go
new file mode 100644
index 0000000..2d6a1ff
--- /dev/null
+++ b/int64.go
@@ -0,0 +1,89 @@
+// Copyright (c) 2020 Uber Technologies, Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+package atomic
+
+import (
+	"encoding/json"
+	"sync/atomic"
+)
+
+// Int64 is an atomic wrapper around an int64.
+type Int64 struct{ v int64 }
+
+// NewInt64 creates an Int64.
+func NewInt64(i int64) *Int64 {
+	return &Int64{i}
+}
+
+// Load atomically loads the wrapped value.
+func (i *Int64) Load() int64 {
+	return atomic.LoadInt64(&i.v)
+}
+
+// Add atomically adds to the wrapped int64 and returns the new value.
+func (i *Int64) Add(n int64) int64 {
+	return atomic.AddInt64(&i.v, n)
+}
+
+// Sub atomically subtracts from the wrapped int64 and returns the new value.
+func (i *Int64) Sub(n int64) int64 {
+	return atomic.AddInt64(&i.v, -n)
+}
+
+// Inc atomically increments the wrapped int64 and returns the new value.
+func (i *Int64) Inc() int64 {
+	return i.Add(1)
+}
+
+// Dec atomically decrements the wrapped int64 and returns the new value.
+func (i *Int64) Dec() int64 {
+	return i.Sub(1)
+}
+
+// CAS is an atomic compare-and-swap.
+func (i *Int64) CAS(old, new int64) bool {
+	return atomic.CompareAndSwapInt64(&i.v, old, new)
+}
+
+// Store atomically stores the passed value.
+func (i *Int64) Store(n int64) {
+	atomic.StoreInt64(&i.v, n)
+}
+
+// Swap atomically swaps the wrapped int64 and returns the old value.
+func (i *Int64) Swap(n int64) int64 {
+	return atomic.SwapInt64(&i.v, n)
+}
+
+// MarshalJSON encodes the wrapped int64 into JSON.
+func (i *Int64) MarshalJSON() ([]byte, error) {
+	return json.Marshal(i.Load())
+}
+
+// UnmarshalJSON decodes JSON into the wrapped int64.
+func (i *Int64) UnmarshalJSON(b []byte) error {
+	var v int64
+	if err := json.Unmarshal(b, &v); err != nil {
+		return err
+	}
+	i.Store(v)
+	return nil
+}
diff --git a/int64_test.go b/int64_test.go
new file mode 100644
index 0000000..b012196
--- /dev/null
+++ b/int64_test.go
@@ -0,0 +1,66 @@
+// Copyright (c) 2020 Uber Technologies, Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+package atomic
+
+import (
+	"encoding/json"
+	"testing"
+
+	"github.com/stretchr/testify/require"
+)
+
+func TestInt64(t *testing.T) {
+	atom := NewInt64(42)
+
+	require.Equal(t, int64(42), atom.Load(), "Load didn't work.")
+	require.Equal(t, int64(46), atom.Add(4), "Add didn't work.")
+	require.Equal(t, int64(44), atom.Sub(2), "Sub didn't work.")
+	require.Equal(t, int64(45), atom.Inc(), "Inc didn't work.")
+	require.Equal(t, int64(44), atom.Dec(), "Dec didn't work.")
+
+	require.True(t, atom.CAS(44, 0), "CAS didn't report a swap.")
+	require.Equal(t, int64(0), atom.Load(), "CAS didn't set the correct value.")
+
+	require.Equal(t, int64(0), atom.Swap(1), "Swap didn't return the old value.")
+	require.Equal(t, int64(1), atom.Load(), "Swap didn't set the correct value.")
+
+	atom.Store(42)
+	require.Equal(t, int64(42), atom.Load(), "Store didn't set the correct value.")
+
+	t.Run("JSON/Marshal", func(t *testing.T) {
+		bytes, err := json.Marshal(atom)
+		require.NoError(t, err, "json.Marshal errored unexpectedly.")
+		require.Equal(t, []byte("42"), bytes, "json.Marshal encoded the wrong bytes.")
+	})
+
+	t.Run("JSON/Unmarshal", func(t *testing.T) {
+		err := json.Unmarshal([]byte("40"), &atom)
+		require.NoError(t, err, "json.Unmarshal errored unexpectedly.")
+		require.Equal(t, int64(40), atom.Load(), "json.Unmarshal didn't set the correct value.")
+	})
+
+	t.Run("JSON/Unmarshal/Error", func(t *testing.T) {
+		err := json.Unmarshal([]byte(`"40"`), &atom)
+		require.Error(t, err, "json.Unmarshal didn't error as expected.")
+		assertErrorJSONUnmarshalType(t, err,
+			"json.Unmarshal failed with unexpected error %v, want UnmarshalTypeError.", err)
+	})
+}
diff --git a/uint32.go b/uint32.go
new file mode 100644
index 0000000..69e8d77
--- /dev/null
+++ b/uint32.go
@@ -0,0 +1,89 @@
+// Copyright (c) 2020 Uber Technologies, Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+package atomic
+
+import (
+	"encoding/json"
+	"sync/atomic"
+)
+
+// Uint32 is an atomic wrapper around an uint32.
+type Uint32 struct{ v uint32 }
+
+// NewUint32 creates a Uint32.
+func NewUint32(i uint32) *Uint32 {
+	return &Uint32{i}
+}
+
+// Load atomically loads the wrapped value.
+func (i *Uint32) Load() uint32 {
+	return atomic.LoadUint32(&i.v)
+}
+
+// Add atomically adds to the wrapped uint32 and returns the new value.
+func (i *Uint32) Add(n uint32) uint32 {
+	return atomic.AddUint32(&i.v, n)
+}
+
+// Sub atomically subtracts from the wrapped uint32 and returns the new value.
+func (i *Uint32) Sub(n uint32) uint32 {
+	return atomic.AddUint32(&i.v, ^(n - 1))
+}
+
+// Inc atomically increments the wrapped uint32 and returns the new value.
+func (i *Uint32) Inc() uint32 {
+	return i.Add(1)
+}
+
+// Dec atomically decrements the wrapped int32 and returns the new value.
+func (i *Uint32) Dec() uint32 {
+	return i.Sub(1)
+}
+
+// CAS is an atomic compare-and-swap.
+func (i *Uint32) CAS(old, new uint32) bool {
+	return atomic.CompareAndSwapUint32(&i.v, old, new)
+}
+
+// Store atomically stores the passed value.
+func (i *Uint32) Store(n uint32) {
+	atomic.StoreUint32(&i.v, n)
+}
+
+// Swap atomically swaps the wrapped uint32 and returns the old value.
+func (i *Uint32) Swap(n uint32) uint32 {
+	return atomic.SwapUint32(&i.v, n)
+}
+
+// MarshalJSON encodes the wrapped uint32 into JSON.
+func (i *Uint32) MarshalJSON() ([]byte, error) {
+	return json.Marshal(i.Load())
+}
+
+// UnmarshalJSON decodes JSON into the wrapped uint32.
+func (i *Uint32) UnmarshalJSON(b []byte) error {
+	var v uint32
+	if err := json.Unmarshal(b, &v); err != nil {
+		return err
+	}
+	i.Store(v)
+	return nil
+}
diff --git a/uint32_test.go b/uint32_test.go
new file mode 100644
index 0000000..4149a47
--- /dev/null
+++ b/uint32_test.go
@@ -0,0 +1,66 @@
+// Copyright (c) 2020 Uber Technologies, Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+package atomic
+
+import (
+	"encoding/json"
+	"testing"
+
+	"github.com/stretchr/testify/require"
+)
+
+func TestUint32(t *testing.T) {
+	atom := NewUint32(42)
+
+	require.Equal(t, uint32(42), atom.Load(), "Load didn't work.")
+	require.Equal(t, uint32(46), atom.Add(4), "Add didn't work.")
+	require.Equal(t, uint32(44), atom.Sub(2), "Sub didn't work.")
+	require.Equal(t, uint32(45), atom.Inc(), "Inc didn't work.")
+	require.Equal(t, uint32(44), atom.Dec(), "Dec didn't work.")
+
+	require.True(t, atom.CAS(44, 0), "CAS didn't report a swap.")
+	require.Equal(t, uint32(0), atom.Load(), "CAS didn't set the correct value.")
+
+	require.Equal(t, uint32(0), atom.Swap(1), "Swap didn't return the old value.")
+	require.Equal(t, uint32(1), atom.Load(), "Swap didn't set the correct value.")
+
+	atom.Store(42)
+	require.Equal(t, uint32(42), atom.Load(), "Store didn't set the correct value.")
+
+	t.Run("JSON/Marshal", func(t *testing.T) {
+		bytes, err := json.Marshal(atom)
+		require.NoError(t, err, "json.Marshal errored unexpectedly.")
+		require.Equal(t, []byte("42"), bytes, "json.Marshal encoded the wrong bytes.")
+	})
+
+	t.Run("JSON/Unmarshal", func(t *testing.T) {
+		err := json.Unmarshal([]byte("40"), &atom)
+		require.NoError(t, err, "json.Unmarshal errored unexpectedly.")
+		require.Equal(t, uint32(40), atom.Load(), "json.Unmarshal didn't set the correct value.")
+	})
+
+	t.Run("JSON/Unmarshal/Error", func(t *testing.T) {
+		err := json.Unmarshal([]byte(`"40"`), &atom)
+		require.Error(t, err, "json.Unmarshal didn't error as expected.")
+		assertErrorJSONUnmarshalType(t, err,
+			"json.Unmarshal failed with unexpected error %v, want UnmarshalTypeError.", err)
+	})
+}
diff --git a/uint64.go b/uint64.go
new file mode 100644
index 0000000..8cab42f
--- /dev/null
+++ b/uint64.go
@@ -0,0 +1,89 @@
+// Copyright (c) 2020 Uber Technologies, Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+package atomic
+
+import (
+	"encoding/json"
+	"sync/atomic"
+)
+
+// Uint64 is an atomic wrapper around a uint64.
+type Uint64 struct{ v uint64 }
+
+// NewUint64 creates a Uint64.
+func NewUint64(i uint64) *Uint64 {
+	return &Uint64{i}
+}
+
+// Load atomically loads the wrapped value.
+func (i *Uint64) Load() uint64 {
+	return atomic.LoadUint64(&i.v)
+}
+
+// Add atomically adds to the wrapped uint64 and returns the new value.
+func (i *Uint64) Add(n uint64) uint64 {
+	return atomic.AddUint64(&i.v, n)
+}
+
+// Sub atomically subtracts from the wrapped uint64 and returns the new value.
+func (i *Uint64) Sub(n uint64) uint64 {
+	return atomic.AddUint64(&i.v, ^(n - 1))
+}
+
+// Inc atomically increments the wrapped uint64 and returns the new value.
+func (i *Uint64) Inc() uint64 {
+	return i.Add(1)
+}
+
+// Dec atomically decrements the wrapped uint64 and returns the new value.
+func (i *Uint64) Dec() uint64 {
+	return i.Sub(1)
+}
+
+// CAS is an atomic compare-and-swap.
+func (i *Uint64) CAS(old, new uint64) bool {
+	return atomic.CompareAndSwapUint64(&i.v, old, new)
+}
+
+// Store atomically stores the passed value.
+func (i *Uint64) Store(n uint64) {
+	atomic.StoreUint64(&i.v, n)
+}
+
+// Swap atomically swaps the wrapped uint64 and returns the old value.
+func (i *Uint64) Swap(n uint64) uint64 {
+	return atomic.SwapUint64(&i.v, n)
+}
+
+// MarshalJSON encodes the wrapped uint64 into JSON.
+func (i *Uint64) MarshalJSON() ([]byte, error) {
+	return json.Marshal(i.Load())
+}
+
+// UnmarshalJSON decodes JSON into the wrapped uint64.
+func (i *Uint64) UnmarshalJSON(b []byte) error {
+	var v uint64
+	if err := json.Unmarshal(b, &v); err != nil {
+		return err
+	}
+	i.Store(v)
+	return nil
+}
diff --git a/uint64_test.go b/uint64_test.go
new file mode 100644
index 0000000..7ff370b
--- /dev/null
+++ b/uint64_test.go
@@ -0,0 +1,66 @@
+// Copyright (c) 2020 Uber Technologies, Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+package atomic
+
+import (
+	"encoding/json"
+	"testing"
+
+	"github.com/stretchr/testify/require"
+)
+
+func TestUint64(t *testing.T) {
+	atom := NewUint64(42)
+
+	require.Equal(t, uint64(42), atom.Load(), "Load didn't work.")
+	require.Equal(t, uint64(46), atom.Add(4), "Add didn't work.")
+	require.Equal(t, uint64(44), atom.Sub(2), "Sub didn't work.")
+	require.Equal(t, uint64(45), atom.Inc(), "Inc didn't work.")
+	require.Equal(t, uint64(44), atom.Dec(), "Dec didn't work.")
+
+	require.True(t, atom.CAS(44, 0), "CAS didn't report a swap.")
+	require.Equal(t, uint64(0), atom.Load(), "CAS didn't set the correct value.")
+
+	require.Equal(t, uint64(0), atom.Swap(1), "Swap didn't return the old value.")
+	require.Equal(t, uint64(1), atom.Load(), "Swap didn't set the correct value.")
+
+	atom.Store(42)
+	require.Equal(t, uint64(42), atom.Load(), "Store didn't set the correct value.")
+
+	t.Run("JSON/Marshal", func(t *testing.T) {
+		bytes, err := json.Marshal(atom)
+		require.NoError(t, err, "json.Marshal errored unexpectedly.")
+		require.Equal(t, []byte("42"), bytes, "json.Marshal encoded the wrong bytes.")
+	})
+
+	t.Run("JSON/Unmarshal", func(t *testing.T) {
+		err := json.Unmarshal([]byte("40"), &atom)
+		require.NoError(t, err, "json.Unmarshal errored unexpectedly.")
+		require.Equal(t, uint64(40), atom.Load(), "json.Unmarshal didn't set the correct value.")
+	})
+
+	t.Run("JSON/Unmarshal/Error", func(t *testing.T) {
+		err := json.Unmarshal([]byte(`"40"`), &atom)
+		require.Error(t, err, "json.Unmarshal didn't error as expected.")
+		assertErrorJSONUnmarshalType(t, err,
+			"json.Unmarshal failed with unexpected error %v, want UnmarshalTypeError.", err)
+	})
+}