source: trunk/lib/bitblock.hpp @ 1616

Last change on this file since 1616 was 1616, checked in by ksherdy, 8 years ago

Removed LONG_BIT macro definition.

File size: 1.7 KB
Line 
1/*
2    IDISA Library Import - Generic
3    Copyright (C) 2011, Robert D. Cameron
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 "idisa.hpp"
15
16#ifndef BLOCK_SIZE
17#define BLOCK_SIZE 128
18#endif
19
20/*  Default BLOCK_SIZE is 128, compatible with SSE, Altivec, SPU */
21#if (BLOCK_SIZE == 128)
22#include "bitblock128.hpp"
23#endif
24
25/*  BLOCK_SIZE 256 for AVX */
26#if (BLOCK_SIZE == 256)
27#include "bitblock256.hpp"
28#endif
29
30/* Wrapper Declarations */
31/*
32#define sisd_sll(blk, n) simd<128>::sll(blk, n)         // TODO - Deprecate 'sisd_f(x,y)'. bitblock_f(x,y) Migrate to simd<sizeof(BitBlock)*8>::f(x,y) or simd<bitblock128_t, 128>::f(x,y)
33#define sisd_srl(blk, n) simd<128>::srl(blk, n)
34#define sisd_slli(blk, n) simd<128>::slli<n>(blk)
35#define sisd_srli(blk, n) simd<128>::srli<n>(blk)
36#define sisd_sfl(blk, n) sisd_sll(blk, n)                       // TODO - Remove forward (f) and backward (b) do not make sense in a little endian based library, just left and right in a register representation
37#define sisd_sbl(blk, n) sisd_srl(blk, n)
38#define sisd_sfli(blk, n) sisd_slli(blk, n)
39#define sisd_sbli(blk, n) sisd_srli(blk, n)
40#define sb_op(x, n) ((x)>>(n))
41#define sf_op(x, n) ((x)<<(n))
42*/
43
44template<class T> void print_register(const char * var_name, T v);      // print integer types as array of unsigned char
45
46/* Debug */
47template <class T>
48void print_register(const char * var_name, T v) {
49        unsigned char c;
50        printf("%20s = ", var_name);
51        for(int i=sizeof(T)-1; i>=0; i--) {
52                c = *(((unsigned char *)&v)+i);
53                printf("%02X ", c);
54        }
55        printf("\n");
56}
57
58#endif /* BITBLOCK_HPP */
59
60
Note: See TracBrowser for help on using the repository browser.