Added bit shift

This commit is contained in:
2022-11-21 01:07:46 -05:00
parent 5836da01ef
commit 317ad4674d
3 changed files with 66 additions and 16 deletions

11
main.go
View File

@@ -80,7 +80,10 @@ func onPress (button stone.Button) {
redraw()
application.Draw()
case '+', '-', '*', '/', 'p', 'r', '%', '|', '~', '&', '^', 'm':
case
'+', '-', '*', '/', 'p', 'r', '%', '|', '~', '&', '^', 'm',
'<', '>':
insertOperation(rune(button))
redraw()
application.Draw()
@@ -232,6 +235,8 @@ func insertOperation (symbol rune) {
case '~': opcode = OpcodeNot
case '&': opcode = OpcodeAnd
case '^': opcode = OpcodeXor
case '<': opcode = OpcodeLeftShift
case '>': opcode = OpcodeRightShift
case 'm': opcode = OpcodeMean
}
@@ -341,6 +346,9 @@ func drawInput () {
func drawNumberReadouts () {
_, height := application.Size()
clear(0, height - 10, 25, 10)
var number int64
var err error
if selectedExpression != nil {
@@ -348,7 +356,6 @@ func drawNumberReadouts () {
}
if err != nil {
clear(0, height - 10, 25, 10)
application.SetDot((25 - len(err.Error())) / 2, height - 6)
fmt.Fprint(application, err.Error())
} else {