Skip to content

Commit

Permalink
Fix bit checks
Browse files Browse the repository at this point in the history
  • Loading branch information
PlasmaPower committed Jan 23, 2024
1 parent 6cca704 commit eba35e5
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions arbstate/das_reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,20 +46,24 @@ const BlobHashesHeaderFlag byte = L1AuthenticatedMessageHeaderFlag | 0x10 // 0x5
// BrotliMessageHeaderByte indicates that the message is brotli-compressed.
const BrotliMessageHeaderByte byte = 0

func hasBits(checking byte, bits byte) bool {
return (checking & bits) == bits
}

func IsDASMessageHeaderByte(header byte) bool {
return (DASMessageHeaderFlag & header) > 0
return hasBits(header, DASMessageHeaderFlag)
}

func IsTreeDASMessageHeaderByte(header byte) bool {
return (TreeDASMessageHeaderFlag & header) > 0
return hasBits(header, TreeDASMessageHeaderFlag)
}

func IsZeroheavyEncodedHeaderByte(header byte) bool {
return (ZeroheavyMessageHeaderFlag & header) > 0
return hasBits(header, ZeroheavyMessageHeaderFlag)
}

func IsBlobHashesHeaderByte(header byte) bool {
return (BlobHashesHeaderFlag & header) > 0
return hasBits(header, BlobHashesHeaderFlag)
}

func IsBrotliMessageHeaderByte(b uint8) bool {
Expand Down

0 comments on commit eba35e5

Please sign in to comment.