@@ -11,13 +11,13 @@ import (
1111)
1212
1313const (
14- ephemeralChunksLimit = 100 // The maximum number of ephemeral chunks that can be created
15- ephemeralChunkSize = 250 // The maximum quantity of ephemeral room's that can be copied/created in a given chunk.
16- roomIdMin32Bit = 1000000000 // 1,000,000,000
14+ ephemeralChunksLimit = 100 // The maximum number of ephemeral chunks that can be created
15+ ephemeralChunkSize = 250 // The maximum quantity of ephemeral room's that can be copied/created in a given chunk.
16+ roomIdMin32Bit = 1000000 // 1,000,000 - Safe for 32-bit systems (was 1 ,000,000,000 which overflows when multiplied by 1000)
1717)
1818
1919var (
20- ephemeralRoomIdMinimum = roomIdMin32Bit // 1,000,000,000 is assuming 32 bit. the init() function may override this value.
20+ ephemeralRoomIdMinimum = roomIdMin32Bit // 1,000,000 is assuming 32 bit. the init() function may override this value to 1,000,000,000 on 64-bit systems .
2121 ephemeralRoomChunks = [ephemeralChunksLimit ][]int {} // map of ranges to actual rooms. If empty, slot is available.
2222 originalRoomIdLookups = map [int ]int {} // a map of ephemeralId's to their original RoomId's, for special purposes
2323 // errors
@@ -232,6 +232,6 @@ func GetOriginalRoom(roomId int) int {
232232
233233func init () {
234234 if math .MaxInt > ephemeralRoomIdMinimum * 1000 {
235- ephemeralRoomIdMinimum = ephemeralRoomIdMinimum * 1000 // 1,000,000,000 => // 1,000,000,000,000
235+ ephemeralRoomIdMinimum = ephemeralRoomIdMinimum * 1000 // 1,000,000 => 1,000,000,000 on 64-bit systems
236236 }
237237}
0 commit comments