source: trunk/lib/bitblock.hpp @ 1861

Last change on this file since 1861 was 1853, checked in by ksherdy, 7 years ago

Removed count forward, count reverse wrappers, and introduced
scan_word_t type for compile time architecture dependent scans.

File size: 1.2 KB
Line 
1/*
2    IDISA Library Import - Generic
3    Copyright (C) 2011, Robert D. Cameron, Kenneth S. Herdy
4    Licensed to the public under the Open Software License 3.0.
5    Licensed to International Characters Inc.
6       under the Academic Free License version 3.0.
7*/
8#ifndef BITBLOCK_HPP
9#define BITBLOCK_HPP
10
11#include <stdint.h>
12#include <stdio.h>
13#include "config.hpp"
14#include "builtins.hpp"
15#include "idisa.hpp"
16
17#define BytePack BitBlock
18#ifndef BLOCK_SIZE
19#define BLOCK_SIZE 128
20#endif
21#define ATTRIBUTE_SIMD_ALIGN __attribute__((aligned(sizeof(BitBlock))))
22
23template<class T> void print_register(const char * var_name, T v);
24
25/*  BitBlock union type */
26union ubitblock;
27
28/*  Default BLOCK_SIZE is 128, compatible with SSE, Altivec, SPU */
29#if (BLOCK_SIZE == 128)
30#include "bitblock128.hpp"
31#endif
32
33/*  BLOCK_SIZE 256 for AVX */
34#if (BLOCK_SIZE == 256)
35#include "bitblock256.hpp"
36#endif
37
38IDISA_ALWAYS_INLINE bool all_true(uint64_t r);
39
40template <class T> void print_register(const char * var_name, T v);
41template <class T>
42void print_register(const char * var_name, T v) {
43        unsigned char c;
44        printf("%20s = ", var_name);
45        for(int i=sizeof(T)-1; i>=0; i--) {
46                c = *(((unsigned char *)&v)+i);
47                printf("%02X ", c);
48        }
49        printf("\n");
50}
51
52#endif /* BITBLOCK_HPP */
53
54
Note: See TracBrowser for help on using the repository browser.