optimize bitfield runs

This commit is contained in:
zgfzgf 2020-11-28 20:17:56 +08:00
parent 8007c1f9ae
commit 21835c785b

View File

@ -38,14 +38,8 @@ var bitFieldCmd = &cli.Command{
var bitFieldRunsCmd = &cli.Command{ var bitFieldRunsCmd = &cli.Command{
Name: "runs", Name: "runs",
Usage: "Bitfield bit runs",
Description: "print bit runs in a bitfield", Description: "print bit runs in a bitfield",
Flags: []cli.Flag{
&cli.StringFlag{
Name: "enc",
Value: "base64",
Usage: "specify input encoding to parse",
},
},
Action: func(cctx *cli.Context) error { Action: func(cctx *cli.Context) error {
var val string var val string
if cctx.Args().Present() { if cctx.Args().Present() {
@ -99,7 +93,7 @@ var bitFieldRunsCmd = &cli.Command{
s = "FALSE" s = "FALSE"
} }
fmt.Printf("@%d %s * %d\n", idx, s, r.Len) fmt.Printf("@%08d %s * %d\n", idx, s, r.Len)
idx += r.Len idx += r.Len
} }