source: trunk/lib/bitblock.hpp @ 1847

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

Remove cfzll reference. A temporary fix to allow the build to succeed on
Windows 32.

File size: 1.9 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
38template<class block_t> IDISA_ALWAYS_INLINE uint32_t count_forward_zeroes(block_t s);
39template<class block_t> IDISA_ALWAYS_INLINE uint32_t count_reverse_zeroes(block_t s);
40template<> IDISA_ALWAYS_INLINE uint32_t count_forward_zeroes<unsigned long>(unsigned long s) {return cfzl(s);}
41//template<> IDISA_ALWAYS_INLINE uint32_t count_forward_zeroes<unsigned long long>(unsigned long long s) {return cfzll(s);}
42template<> IDISA_ALWAYS_INLINE uint32_t count_reverse_zeroes<unsigned long>(unsigned long s) {return cbzl(s);}
43//template<> IDISA_ALWAYS_INLINE uint32_t count_reverse_zeroes<unsigned long long>(unsigned long long s) {return cbzll(s);}
44
45IDISA_ALWAYS_INLINE bool all_true(uint64_t r);
46
47template <class T> void print_register(const char * var_name, T v);
48template <class T>
49void print_register(const char * var_name, T v) {
50        unsigned char c;
51        printf("%20s = ", var_name);
52        for(int i=sizeof(T)-1; i>=0; i--) {
53                c = *(((unsigned char *)&v)+i);
54                printf("%02X ", c);
55        }
56        printf("\n");
57}
58
59#endif /* BITBLOCK_HPP */
60
61
Note: See TracBrowser for help on using the repository browser.