Skip to content

Commit

Permalink
s/-1/0xFF/
Browse files Browse the repository at this point in the history
  • Loading branch information
peterbourgon authored Mar 13, 2024
1 parent 5f985ca commit a67312a
Showing 1 changed file with 27 additions and 27 deletions.
54 changes: 27 additions & 27 deletions ulid.go
Original file line number Diff line number Diff line change
Expand Up @@ -361,34 +361,34 @@ func (id ULID) MarshalTextTo(dst []byte) error {
}

// Byte to index table for O(1) lookups when unmarshaling.
// We use -1 (all bits are 1) as sentinel value for invalid indexes.
// We use 0xFF as sentinel value for invalid indexes.
var dec = [...]int8{
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, 0x00, 0x01,
0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, -1, -1,
-1, -1, -1, -1, -1, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E,
0x0F, 0x10, 0x11, -1, 0x12, 0x13, -1, 0x14, 0x15, -1,
0x16, 0x17, 0x18, 0x19, 0x1A, -1, 0x1B, 0x1C, 0x1D, 0x1E,
0x1F, -1, -1, -1, -1, -1, -1, 0x0A, 0x0B, 0x0C,
0x0D, 0x0E, 0x0F, 0x10, 0x11, -1, 0x12, 0x13, -1, 0x14,
0x15, -1, 0x16, 0x17, 0x18, 0x19, 0x1A, -1, 0x1B, 0x1C,
0x1D, 0x1E, 0x1F, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,

Check failure on line 366 in ulid.go

View workflow job for this annotation

GitHub Actions / lint

cannot use 0xFF (untyped int constant 255) as int8 value in array or slice literal (overflows)

Check failure on line 366 in ulid.go

View workflow job for this annotation

GitHub Actions / test (1.x, ubuntu-latest)

cannot use 0xFF (untyped int constant 255) as int8 value in array or slice literal (overflows)

Check failure on line 366 in ulid.go

View workflow job for this annotation

GitHub Actions / test (1.x, macos-latest)

cannot use 0xFF (untyped int constant 255) as int8 value in array or slice literal (overflows)
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,

Check failure on line 367 in ulid.go

View workflow job for this annotation

GitHub Actions / lint

cannot use 0xFF (untyped int constant 255) as int8 value in array or slice literal (overflows)

Check failure on line 367 in ulid.go

View workflow job for this annotation

GitHub Actions / test (1.x, ubuntu-latest)

cannot use 0xFF (untyped int constant 255) as int8 value in array or slice literal (overflows)

Check failure on line 367 in ulid.go

View workflow job for this annotation

GitHub Actions / test (1.x, macos-latest)

cannot use 0xFF (untyped int constant 255) as int8 value in array or slice literal (overflows)
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,

Check failure on line 368 in ulid.go

View workflow job for this annotation

GitHub Actions / lint

cannot use 0xFF (untyped int constant 255) as int8 value in array or slice literal (overflows)

Check failure on line 368 in ulid.go

View workflow job for this annotation

GitHub Actions / test (1.x, ubuntu-latest)

cannot use 0xFF (untyped int constant 255) as int8 value in array or slice literal (overflows)

Check failure on line 368 in ulid.go

View workflow job for this annotation

GitHub Actions / test (1.x, macos-latest)

cannot use 0xFF (untyped int constant 255) as int8 value in array or slice literal (overflows)
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,

Check failure on line 369 in ulid.go

View workflow job for this annotation

GitHub Actions / lint

cannot use 0xFF (untyped int constant 255) as int8 value in array or slice literal (overflows)

Check failure on line 369 in ulid.go

View workflow job for this annotation

GitHub Actions / test (1.x, ubuntu-latest)

cannot use 0xFF (untyped int constant 255) as int8 value in array or slice literal (overflows)

Check failure on line 369 in ulid.go

View workflow job for this annotation

GitHub Actions / test (1.x, macos-latest)

cannot use 0xFF (untyped int constant 255) as int8 value in array or slice literal (overflows)
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x01,

Check failure on line 370 in ulid.go

View workflow job for this annotation

GitHub Actions / lint

cannot use 0xFF (untyped int constant 255) as int8 value in array or slice literal (overflows)

Check failure on line 370 in ulid.go

View workflow job for this annotation

GitHub Actions / test (1.x, ubuntu-latest)

cannot use 0xFF (untyped int constant 255) as int8 value in array or slice literal (overflows)

Check failure on line 370 in ulid.go

View workflow job for this annotation

GitHub Actions / test (1.x, macos-latest)

cannot use 0xFF (untyped int constant 255) as int8 value in array or slice literal (overflows)
0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0xFF, 0xFF,

Check failure on line 371 in ulid.go

View workflow job for this annotation

GitHub Actions / lint

cannot use 0xFF (untyped int constant 255) as int8 value in array or slice literal (overflows)

Check failure on line 371 in ulid.go

View workflow job for this annotation

GitHub Actions / test (1.x, ubuntu-latest)

cannot use 0xFF (untyped int constant 255) as int8 value in array or slice literal (overflows)

Check failure on line 371 in ulid.go

View workflow job for this annotation

GitHub Actions / test (1.x, macos-latest)

cannot use 0xFF (untyped int constant 255) as int8 value in array or slice literal (overflows)
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E,

Check failure on line 372 in ulid.go

View workflow job for this annotation

GitHub Actions / lint

cannot use 0xFF (untyped int constant 255) as int8 value in array or slice literal (overflows)

Check failure on line 372 in ulid.go

View workflow job for this annotation

GitHub Actions / test (1.x, ubuntu-latest)

cannot use 0xFF (untyped int constant 255) as int8 value in array or slice literal (overflows)

Check failure on line 372 in ulid.go

View workflow job for this annotation

GitHub Actions / test (1.x, macos-latest)

cannot use 0xFF (untyped int constant 255) as int8 value in array or slice literal (overflows)
0x0F, 0x10, 0x11, 0xFF, 0x12, 0x13, 0xFF, 0x14, 0x15, 0xFF,

Check failure on line 373 in ulid.go

View workflow job for this annotation

GitHub Actions / lint

cannot use 0xFF (untyped int constant 255) as int8 value in array or slice literal (overflows)

Check failure on line 373 in ulid.go

View workflow job for this annotation

GitHub Actions / test (1.x, ubuntu-latest)

cannot use 0xFF (untyped int constant 255) as int8 value in array or slice literal (overflows)

Check failure on line 373 in ulid.go

View workflow job for this annotation

GitHub Actions / test (1.x, macos-latest)

cannot use 0xFF (untyped int constant 255) as int8 value in array or slice literal (overflows)
0x16, 0x17, 0x18, 0x19, 0x1A, 0xFF, 0x1B, 0x1C, 0x1D, 0x1E,

Check failure on line 374 in ulid.go

View workflow job for this annotation

GitHub Actions / lint

cannot use 0xFF (untyped int constant 255) as int8 value in array or slice literal (overflows)

Check failure on line 374 in ulid.go

View workflow job for this annotation

GitHub Actions / test (1.x, ubuntu-latest)

cannot use 0xFF (untyped int constant 255) as int8 value in array or slice literal (overflows)

Check failure on line 374 in ulid.go

View workflow job for this annotation

GitHub Actions / test (1.x, macos-latest)

cannot use 0xFF (untyped int constant 255) as int8 value in array or slice literal (overflows)
0x1F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x0A, 0x0B, 0x0C,

Check failure on line 375 in ulid.go

View workflow job for this annotation

GitHub Actions / lint

cannot use 0xFF (untyped int constant 255) as int8 value in array or slice literal (overflows)

Check failure on line 375 in ulid.go

View workflow job for this annotation

GitHub Actions / test (1.x, ubuntu-latest)

cannot use 0xFF (untyped int constant 255) as int8 value in array or slice literal (overflows)

Check failure on line 375 in ulid.go

View workflow job for this annotation

GitHub Actions / test (1.x, macos-latest)

cannot use 0xFF (untyped int constant 255) as int8 value in array or slice literal (overflows)
0x0D, 0x0E, 0x0F, 0x10, 0x11, 0xFF, 0x12, 0x13, 0xFF, 0x14,
0x15, 0xFF, 0x16, 0x17, 0x18, 0x19, 0x1A, 0xFF, 0x1B, 0x1C,
0x1D, 0x1E, 0x1F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
}

// EncodedSize is the length of a text encoded ULID.
Expand Down

0 comments on commit a67312a

Please sign in to comment.