Added bit shift
This commit is contained in:
11
main.go
11
main.go
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user