mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-23 21:18:37 +01:00
Adds in the modulo operator to the circuit arithmetic component. (#88253)
## About The Pull Request  This PR just adds in modulo to the circuit arithmetic component. ## Why It's Good For The Game You _can_ calculate it yourself, but then it ends up extremely unoptimal and you're usually better off not doing it. It also ends up really hard to read. I want to see more clever circuits and computing things. ## Changelog 🆑 add: Added in the modulo operator to the circuit arithmetic component. /🆑
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
#define COMP_ARITHMETIC_SUBTRACT "Subtract"
|
||||
#define COMP_ARITHMETIC_MULTIPLY "Multiply"
|
||||
#define COMP_ARITHMETIC_DIVIDE "Divide"
|
||||
#define COMP_ARITHMETIC_MODULO "Modulo"
|
||||
#define COMP_ARITHMETIC_MIN "Minimum"
|
||||
#define COMP_ARITHMETIC_MAX "Maximum"
|
||||
|
||||
@@ -34,6 +35,7 @@
|
||||
COMP_ARITHMETIC_SUBTRACT,
|
||||
COMP_ARITHMETIC_MULTIPLY,
|
||||
COMP_ARITHMETIC_DIVIDE,
|
||||
COMP_ARITHMETIC_MODULO,
|
||||
COMP_ARITHMETIC_MIN,
|
||||
COMP_ARITHMETIC_MAX,
|
||||
)
|
||||
@@ -75,6 +77,8 @@
|
||||
result = null
|
||||
break
|
||||
result /= value
|
||||
if(COMP_ARITHMETIC_MODULO)
|
||||
result %= value
|
||||
if(COMP_ARITHMETIC_MAX)
|
||||
result = max(result, value)
|
||||
if(COMP_ARITHMETIC_MIN)
|
||||
@@ -86,5 +90,6 @@
|
||||
#undef COMP_ARITHMETIC_SUBTRACT
|
||||
#undef COMP_ARITHMETIC_MULTIPLY
|
||||
#undef COMP_ARITHMETIC_DIVIDE
|
||||
#undef COMP_ARITHMETIC_MODULO
|
||||
#undef COMP_ARITHMETIC_MIN
|
||||
#undef COMP_ARITHMETIC_MAX
|
||||
|
||||
Reference in New Issue
Block a user