Skip to content

Commit

Permalink
Added hex_rev_u32 to tools names.
Browse files Browse the repository at this point in the history
  • Loading branch information
abourget committed Jun 25, 2019
1 parent 3123cad commit 9b7160b
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions eosc/cmd/toolsNames.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"encoding/binary"
"encoding/hex"
"fmt"
"math"
"os"
"regexp"
"strconv"
Expand Down Expand Up @@ -78,7 +79,7 @@ func printName(input string) {
}

someFound := false
rows := []string{"| from \\ to | hex | hex_be | name | uint64 | symbol | symbol_code", "| --------- | --- | ------ | ---- | ------ | ------ | ----------- |"}
rows := []string{"| from \\ to | hex | hex_be | hex_rev_u32 | name | uint64 | symbol | symbol_code", "| --------- | --- | ------ | ----------- | ---- | ------ | ------ | ----------- |"}
for _, from := range []string{"hex", "hex_be", "name", "uint64", "symbol", "symbol_code"} {
val, found := showFrom[from]
if !found {
Expand All @@ -87,7 +88,7 @@ func printName(input string) {
someFound = true

row := []string{from}
for _, to := range []string{"hex", "hex_be", "name", "uint64", "symbol", "symbol_code"} {
for _, to := range []string{"hex", "hex_be", "hex_rev_u32", "name", "uint64", "symbol", "symbol_code"} {

cnt := make([]byte, 8)
switch to {
Expand All @@ -98,6 +99,15 @@ func printName(input string) {
binary.BigEndian.PutUint64(cnt, val)
row = append(row, hex.EncodeToString(cnt))

case "hex_rev_u32":
if val > math.MaxUint32 {
row = append(row, "-")
} else {
cnt4 := make([]byte, 4)
binary.BigEndian.PutUint32(cnt4, math.MaxUint32-uint32(val))
row = append(row, hex.EncodeToString(cnt4))
}

case "name":
row = append(row, eos.NameToString(val))

Expand Down

0 comments on commit 9b7160b

Please sign in to comment.