Source File
bitwriter.go
Belonging Package
github.com/andybalholm/brotli
package brotli/* Copyright 2010 Google Inc. All Rights Reserved.Distributed under MIT license.See file LICENSE for detail or copy at https://opensource.org/licenses/MIT*//* Write bits into a byte array. */type bitWriter struct {dst []byte// Data waiting to be written is the low nbits of bits.bits uint64nbits uint}func ( *bitWriter) ( uint, uint64) {.bits |= << .nbits.nbits +=if .nbits >= 32 {:= .bits.bits >>= 32.nbits -= 32.dst = append(.dst,byte(),byte(>>8),byte(>>16),byte(>>24),)}}func ( *bitWriter) ( bool) {if {.writeBits(1, 1)} else {.writeBits(1, 0)}}func ( *bitWriter) () {:= .dstfor .nbits != 0 {= append(, byte(.bits)).bits >>= 8if .nbits > 8 { // Avoid underflow.nbits -= 8} else {.nbits = 0}}.bits = 0.dst =}
![]() |
The pages are generated with Golds v0.8.2. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |