From f2b0ea746d71cececc638077bfd7f2f47e128c14 Mon Sep 17 00:00:00 2001 From: UnavailableDev <69792062+UnavailableDev@users.noreply.github.com> Date: Sat, 15 Jun 2024 11:53:24 +0200 Subject: updated NOT-gate implementation --- GateNot.cpp | 12 ++++-------- 1 file 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() { } -- cgit v1.2.3