Feature/add converters and bitwise ops (#20)

* added:

- converters
- bitwise operators
- hex input and output support
This commit is contained in:
T.v.Dein
2023-11-13 15:51:07 +01:00
committed by GitHub
parent 127483eea1
commit 59241932e0
7 changed files with 176 additions and 3 deletions

View File

@@ -117,6 +117,15 @@ func (c *Calc) SetCommands() {
}
},
),
"hex": NewCommand(
"show last stack item in hex form (converted to int)",
func(c *Calc) {
if c.stack.Len() > 0 {
fmt.Printf("0x%x\n", int(c.stack.Last()[0]))
}
},
),
}
c.StackCommands = Commands{