mirror of
https://github.com/VectorCamp/vectorscan.git
synced 2025-06-28 16:41:01 +03:00
convert print helper functions to class methods
This commit is contained in:
parent
78e098661f
commit
c45e72775f
@ -91,6 +91,7 @@ struct BaseVector
|
|||||||
static const bool is_valid = false; // for template matches specialisation
|
static const bool is_valid = false; // for template matches specialisation
|
||||||
using type = void;
|
using type = void;
|
||||||
using movemask_type = uint32_t;
|
using movemask_type = uint32_t;
|
||||||
|
using previous_type = void;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
@ -156,6 +157,7 @@ public:
|
|||||||
double f64[SIZE / sizeof(double)];
|
double f64[SIZE / sizeof(double)];
|
||||||
} u;
|
} u;
|
||||||
|
|
||||||
|
SuperVector() {};
|
||||||
SuperVector(SuperVector const &other);
|
SuperVector(SuperVector const &other);
|
||||||
SuperVector(typename base_type::type const v);
|
SuperVector(typename base_type::type const v);
|
||||||
|
|
||||||
@ -173,8 +175,6 @@ public:
|
|||||||
|
|
||||||
void operator=(SuperVector const &other);
|
void operator=(SuperVector const &other);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
SuperVector operator&(SuperVector const &b) const;
|
SuperVector operator&(SuperVector const &b) const;
|
||||||
SuperVector operator|(SuperVector const &b) const;
|
SuperVector operator|(SuperVector const &b) const;
|
||||||
SuperVector operator^(SuperVector const &b) const;
|
SuperVector operator^(SuperVector const &b) const;
|
||||||
@ -202,51 +202,42 @@ public:
|
|||||||
// Constants
|
// Constants
|
||||||
static SuperVector Ones();
|
static SuperVector Ones();
|
||||||
static SuperVector Zeroes();
|
static SuperVector Zeroes();
|
||||||
};
|
|
||||||
|
|
||||||
//class SuperVector<16>;
|
|
||||||
// class SuperVector<32>;
|
|
||||||
// class SuperVector<64>;
|
|
||||||
// class SuperVector<128>;
|
|
||||||
|
|
||||||
#if defined(DEBUG)
|
#if defined(DEBUG)
|
||||||
template <uint16_t S>
|
void print8(const char *label) {
|
||||||
static void printv_u8(const char *label, SuperVector<S> const &v) {
|
printf("%12s: ", label);
|
||||||
printf("%s: ", label);
|
for(s16 i=SIZE-1; i >= 0; i--)
|
||||||
for(size_t i=0; i < S; i++)
|
printf("%02x ", u.u8[i]);
|
||||||
printf("%02x ", v.u.u8[i]);
|
|
||||||
printf("\n");
|
printf("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
template <uint16_t S>
|
void print16(const char *label) {
|
||||||
static void printv_u16(const char *label, SuperVector<S> const &v) {
|
printf("%12s: ", label);
|
||||||
printf("%s: ", label);
|
for(s16 i=SIZE/sizeof(u16)-1; i >= 0; i--)
|
||||||
for(size_t i=0; i < S/sizeof(u16); i++)
|
printf("%04x ", u.u16[i]);
|
||||||
printf("%04x ", v.u.u16[i]);
|
|
||||||
printf("\n");
|
printf("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
template <uint16_t S>
|
void print32(const char *label) {
|
||||||
static void printv_u32(const char *label, SuperVector<S> const &v) {
|
printf("%12s: ", label);
|
||||||
printf("%s: ", label);
|
for(s16 i=SIZE/sizeof(u32)-1; i >= 0; i--)
|
||||||
for(size_t i=0; i < S/sizeof(u32); i++)
|
printf("%08x ", u.u32[i]);
|
||||||
printf("%08x ", v.u.u32[i]);
|
|
||||||
printf("\n");
|
printf("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
template <uint16_t S>
|
void printv_u64(const char *label) {
|
||||||
static inline void printv_u64(const char *label, SuperVector<S> const &v) {
|
printf("%12s: ", label);
|
||||||
printf("%s: ", label);
|
for(s16 i=SIZE/sizeof(u64a)-1; i >= 0; i--)
|
||||||
for(size_t i=0; i < S/sizeof(u64a); i++)
|
printf("%016lx ", u.u64[i]);
|
||||||
printf("%016lx ", v.u.u64[i]);
|
|
||||||
printf("\n");
|
printf("\n");
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
#define printv_u8(a, b) ;
|
void print8(const char *label UNUSED) {};
|
||||||
#define printv_u16(a, b) ;
|
void print16(const char *label UNUSED) {};
|
||||||
#define printv_u32(a, b) ;
|
void print32(const char *label UNUSED) {};
|
||||||
#define printv_u64(a, b) ;
|
void printv_u64(const char *label UNUSED) {};
|
||||||
#endif
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
#if defined(HS_OPTIMIZE)
|
#if defined(HS_OPTIMIZE)
|
||||||
#if defined(ARCH_IA32) || defined(ARCH_X86_64)
|
#if defined(ARCH_IA32) || defined(ARCH_X86_64)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user