Skip to content

Commit

Permalink
Doc tweaks.
Browse files Browse the repository at this point in the history
  • Loading branch information
bobg committed Mar 5, 2023
1 parent 31dd43b commit d623d46
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ To get the Base30 encoding of the number 412:
result, err := basexx.Digits(412, basexx.Base30)
```

To decode the base30 digit string `"fr"`:
To decode the Base30 digit string `"fr"`:

```go
result, err := basexx.Value("fr", basexx.Base30)
Expand Down
3 changes: 3 additions & 0 deletions basexx.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,11 @@ var zero = new(big.Int)
// Convert converts the digits of src, writing them to dest.
// Both src and dest specify their bases.
// Return value is the number of digits written to dest (even in case of error).
//
// This function consumes all of src before producing any of dest,
// so it may not be suitable for input streams of arbitrary length.
// In particular,
// do not expect to be able to use it for encoding byte streams the way you can with e.g. encoding/base64.
func Convert(dest Dest, src Source) (int, error) {
var (
accum = new(big.Int)
Expand Down
5 changes: 5 additions & 0 deletions buffer.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ type Buffer struct {
}

// NewBuffer produces a Buffer from the given byte slice described by the given Base.
//
// When the Buffer is to be used as a Dest in a call to Convert,
// the supplied []byte must have length >= Length(from, base.N(), digits)
// where `from` is the base you're converting from
// and `digits` is the number of digits being converted.
func NewBuffer(buf []byte, base Base) *Buffer {
return &Buffer{
buf: buf,
Expand Down

0 comments on commit d623d46

Please sign in to comment.