First draft of performance test SQL schema.
[beedb.git] / exp / packed_test.cc
blobb7d881b43c5e4ba8307173ecabba039f9c134233
1 /*
2 Copyright 2008 Kristian Nielsen
4 This file is part of BeeDB.
6 Foobar is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 2 of the License, or
9 (at your option) any later version.
11 Foobar is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with Foobar. If not, see <http://www.gnu.org/licenses/>.
20 #include <stdint.h>
21 #include <stdio.h>
23 #include "packed_mask.h"
25 uint64_t read1(uint64_t *base, uint count)
27 uint64_t r= 0;
28 pack_ptr_mask p(base);
30 while (count--)
31 r+= p.unpack1();
33 return r;
36 uint64_t read2(uint64_t *base, uint count)
38 uint64_t r= 0;
39 pack_ptr_mask p(base);
41 while (count--)
42 r+= p.unpack2();
44 return r;
47 int main(int argc, char *argv[])
49 uint64_t word= 0xfedcba9876543210UL;
50 pack_ptr_mask p(&word);
51 printf("%lx\n", (unsigned long)p.getbits(3));
52 printf("%lx\n", (unsigned long)p.getbits(7));
53 return 0;