comparison lshlib.cpp @ 589:9119f2fa3efe

Header file rearrangement Make it so that lshlib.h is slightly more like a header file to include to use the LSH ("class G") class, and slightly less a header file for developing that class, by removing all the #includes and moving them to the one-file lshlib.cpp instead. Make audioDB-internals.h slightly more of a project header file, by including there all the headers we actually need. Remove some assert()s (which do nothing) and some Uns32Ts (-> uint32_t)
author mas01cr
date Tue, 11 Aug 2009 21:42:13 +0000
parents 57e459f62788
children 4b79043f90ba
comparison
equal deleted inserted replaced
588:638e1647b199 589:9119f2fa3efe
1 #include <vector>
2 #include <queue>
3 #include <stdio.h>
4 #include <stdlib.h>
5 #include <sys/types.h>
6 #include <sys/stat.h>
7 #include <sys/mman.h>
8 #include <fcntl.h>
9 #include <string.h>
10 #include <iostream>
11 #include <fstream>
12 #include <math.h>
13 #include <sys/time.h>
14 #include <assert.h>
15 #include <float.h>
16 #include <signal.h>
17 #include <time.h>
18 #include <limits.h>
19 #include <errno.h>
20 #ifdef MT19937
21 #include "mt19937/mt19937ar.h"
22 #endif
23
1 #include "lshlib.h" 24 #include "lshlib.h"
2
3 25
4 void err(char*s){cout << s << endl;exit(2);} 26 void err(char*s){cout << s << endl;exit(2);}
5 27
6 Uns32T get_page_logn(){ 28 Uns32T get_page_logn(){
7 int pagesz = (int)sysconf(_SC_PAGESIZE); 29 int pagesz = (int)sysconf(_SC_PAGESIZE);
8 return (Uns32T)log2((double)pagesz); 30 return (Uns32T)log2((double)pagesz);
9 } 31 }
10
11 unsigned align_up(unsigned x, unsigned w) { return (((x) + ((1<<w)-1)) & ~((1<<w)-1)); }
12 32
13 void H::error(const char* a, const char* b, const char *sysFunc) { 33 void H::error(const char* a, const char* b, const char *sysFunc) {
14 cerr << a << ": " << b << endl; 34 cerr << a << ": " << b << endl;
15 if (sysFunc) { 35 if (sysFunc) {
16 perror(sysFunc); 36 perror(sysFunc);