forked from capnproto/go-capnp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Progress towards capnproto#364. This gets all of the really "easy" cases in the main and rpc pacakges; the remainder will require building a couple less trivial helpers.
- Loading branch information
Showing
6 changed files
with
51 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package capnp | ||
|
||
// Helpers for formatting strings. We avoid the use of the fmt package for the benefit | ||
// of environments that care about minimizing executable size. | ||
|
||
import "strconv" | ||
|
||
// An address is an index inside a segment's data (in bytes). | ||
// It is bounded to [0, maxSegmentSize). | ||
type address uint32 | ||
|
||
// fmtUdecimal is a helper for formatting unsigned integers as decimals. | ||
func fmtUdecimal[T isUint](n T) string { | ||
return strconv.FormatUint(uint64(n), 10) | ||
} | ||
|
||
// Like fmtIdecimal, but for signed integers. | ||
func fmtIdecimal[T isInt](n T) string { | ||
return strconv.FormatInt(int64(n), 10) | ||
} | ||
|
||
type isUint interface { | ||
~uint8 | ~uint16 | ~uint32 | ~uint64 | ~uint | ||
} | ||
|
||
type isInt interface { | ||
~int8 | ~int16 | ~int32 | ~int64 | ~int | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters