aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUnavailableDev <69792062+UnavailableDev@users.noreply.github.com>2024-06-15 11:53:24 +0200
committerUnavailableDev <69792062+UnavailableDev@users.noreply.github.com>2024-06-15 11:53:24 +0200
commitf2b0ea746d71cececc638077bfd7f2f47e128c14 (patch)
tree74043c2786fbd68e3ad63a731d94b6cc64ed65c6
parentfb13553bd31ca408dbc301c1aa28e8a2c96e4466 (diff)
updated NOT-gate implementation
-rw-r--r--GateNot.cpp12
1 files changed, 4 insertions, 8 deletions
diff --git a/GateNot.cpp b/GateNot.cpp
index c272022..a29744f 100644
--- a/GateNot.cpp
+++ b/GateNot.cpp
@@ -3,14 +3,10 @@
GateNot GateNot::instance(GateNot::type);
SignalLevel GateNot::level() {
- SignalLevel new_level = LOW;
- for (int i = 0; i < this->inputs.size(); i++){
- SignalLevel l = this->inputs[i]->getLevel();
-
- if (l == UNDEFINED) return UNDEFINED;
- if (l == HIGH) new_level = HIGH;
- }
- return new_level;
+ SignalLevel lvl = this->inputs[0]->getLevel();
+ if (lvl == LOW) return HIGH;
+ if (lvl == HIGH) return LOW;
+ return UNDEFINED;
}
GateNot::GateNot(const GateNot * prototype) : Node() { }