From cf7e434c8005fc79f563be98542aa1d42a85f869 Mon Sep 17 00:00:00 2001 From: "demin.han" Date: Thu, 8 Jun 2023 10:51:31 +0800 Subject: [PATCH] Replace ternary operator with std:min --- riscv/vector_unit.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/riscv/vector_unit.cc b/riscv/vector_unit.cc index ff3dd82f..9128df63 100644 --- a/riscv/vector_unit.cc +++ b/riscv/vector_unit.cc @@ -54,11 +54,11 @@ reg_t vectorUnit_t::vectorUnit_t::set_vl(int rd, int rs1, reg_t reqVL, reg_t new if (vlmax == 0) { vl->write_raw(0); } else if (rd == 0 && rs1 == 0) { - vl->write_raw(vl->read() > vlmax ? vlmax : vl->read()); + vl->write_raw(std::min(vl->read(), vlmax)); } else if (rd != 0 && rs1 == 0) { vl->write_raw(vlmax); } else if (rs1 != 0) { - vl->write_raw(reqVL > vlmax ? vlmax : reqVL); + vl->write_raw(std::min(reqVL, vlmax)); } vstart->write_raw(0);