compress/flate

93 views
Skip to first unread message

Heisenberg

unread,
Jul 17, 2020, 5:23:48 AM7/17/20
to golang-nuts
Constant definition in token.go:

literalType = 0 << 30

The only use I see is:

  • func (t token) literal() uint32 { return uint32(t - literalType) }
  • func literalToken(literal uint32) token { return token(literalType + literal) }

I don't know what the purpose of this writing is. Is it okay to remove literalType?

Jan Mercl

unread,
Jul 17, 2020, 5:33:22 AM7/17/20
to Heisenberg, golang-nuts
No, it's a particular value of bitfield. That the value happens to be
zero does not matter. Written this way it's future-proof - would the
value need change to some other value.

Nick Keets

unread,
Jul 20, 2020, 8:55:54 AM7/20/20
to Jan Mercl, Heisenberg, golang-nuts
Updating those 2 lines would be the least of our problems if this value ever changes.

--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/CAA40n-Wg7%3DYBo6pkVWxEmfCq4VNzeydDUUZA%2BQN2cHEU6ohJuw%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages