diff --git a/gencapdefs.py b/gencapdefs.py index f3825c51..6a486521 100644 --- a/gencapdefs.py +++ b/gencapdefs.py @@ -204,8 +204,8 @@ package caps numCapabs = len(CAPDEFS) - bitsetLen = numCapabs // 64 - if numCapabs % 64 > 0: + bitsetLen = numCapabs // 32 + if numCapabs % 32 > 0: bitsetLen += 1 print (""" const ( diff --git a/irc/caps/set.go b/irc/caps/set.go index 0e5f7949..1e8ea4b3 100644 --- a/irc/caps/set.go +++ b/irc/caps/set.go @@ -11,7 +11,7 @@ import ( ) // Set holds a set of enabled capabilities. -type Set [bitsetLen]uint64 +type Set [bitsetLen]uint32 // NewSet returns a new Set, with the given capabilities enabled. func NewSet(capabs ...Capability) *Set { diff --git a/irc/modes/modes.go b/irc/modes/modes.go index 05e93938..aba6b447 100644 --- a/irc/modes/modes.go +++ b/irc/modes/modes.go @@ -7,7 +7,6 @@ package modes import ( "strings" - "sync/atomic" "github.com/oragono/oragono/irc/utils" ) @@ -318,12 +317,13 @@ func ParseChannelModeChanges(params ...string) (ModeChanges, map[rune]bool) { } // ModeSet holds a set of modes. -type ModeSet [1]uint64 +type ModeSet [2]uint32 // valid modes go from 65 ('A') to 122 ('z'), making at most 58 possible values; -// subtract 65 from the mode value and use that bit of the uint64 to represent it +// subtract 65 from the mode value and use that bit of the uint32 to represent it const ( - minMode = 65 // 'A' + minMode = 65 // 'A' + maxMode = 122 // 'z' ) // returns a pointer to a new ModeSet @@ -357,11 +357,10 @@ func (set *ModeSet) AllModes() (result []Mode) { return } - block := atomic.LoadUint64(&set[0]) - var i uint - for i = 0; i < 64; i++ { - if block&(1<