From abbefb91099a2d9205159384a0b541531c20fd31 Mon Sep 17 00:00:00 2001 From: MITSUNARI Shigeo Date: Wed, 18 May 2016 13:39:33 +0900 Subject: [PATCH] move unit, bit, N to derived class --- src/gen.cpp | 7 ++++++- src/llvm_gen.hpp | 13 +------------ 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/src/gen.cpp b/src/gen.cpp index 325086f..8f72724 100644 --- a/src/gen.cpp +++ b/src/gen.cpp @@ -1,6 +1,9 @@ #include "llvm_gen.hpp" struct OnceCode : public mcl::Generator { + uint32_t unit; + uint32_t bit; + uint32_t N; uint32_t unit2; Function mulUU; Function extractHigh; @@ -54,7 +57,9 @@ struct OnceCode : public mcl::Generator { } void gen(uint32_t unit, uint32_t bit) { - set(unit, bit); + this->unit = unit; + this->bit = bit; + N = bit / unit; unit2 = unit * 2; gen_mulUU(); gen_extractHigh(); diff --git a/src/llvm_gen.hpp b/src/llvm_gen.hpp index f97d075..501a4d3 100644 --- a/src/llvm_gen.hpp +++ b/src/llvm_gen.hpp @@ -66,22 +66,11 @@ struct Generator { , isPtr((type & Ptr) != 0) { } - static inline friend std::ostream& operator<<(std::ostream& os, const Type& self) + inline friend std::ostream& operator<<(std::ostream& os, const Type& self) { return os << (self.type | (self.isPtr ? Ptr : 0)); } }; - Type type; - uint32_t unit; - uint32_t bit; - uint32_t N; - Generator() : unit(0), bit(0), N(0) {} - void set(uint32_t unit, uint32_t bit) - { - this->unit = unit; - this->bit = bit; - this->N = bit / unit; - } void open(const std::string& file) { impl::Param<>::f.open(file);