move unit, bit, N to derived class

dev
MITSUNARI Shigeo 9 years ago
parent ab390ce3ec
commit abbefb9109
  1. 7
      src/gen.cpp
  2. 13
      src/llvm_gen.hpp

@ -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();

@ -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);

Loading…
Cancel
Save