#include "idep_nameindexmap.h"#include "idep_namearray.h"#include <string.h>#include <memory.h>#include <iostream>#include <cassert>Go to the source code of this file.
Classes | |
| struct | idep_NameIndexMapLink |
| struct | idep_NameIndexMap_i |
Enumerations | |
| enum | { DEFAULT_TABLE_SIZE = 521 } |
| enum | { BAD_INDEX = -1 } |
Functions | |
| unsigned | hash (register const char *name) |
| const idep_NameIndexMapLink * | find (const idep_NameIndexMapLink *p, const char *name) |
| std::ostream & | operator<< (std::ostream &out, const idep_NameIndexMap &map) |
|
|
Definition at line 12 of file idep_nimap.cxx. 00012 { DEFAULT_TABLE_SIZE = 521 };
|
|
|
Definition at line 13 of file idep_nimap.cxx. 00013 { BAD_INDEX = -1 };
|
|
||||||||||||
|
|
Definition at line 15 of file idep_nimap.cxx. Referenced by idep_AliasTable::add(), idep_NameIndexMap_i::findSlot(), and idep_AliasTable::lookup(). 00015 : returns unsigned! 00016 { 00017 register unsigned sum = 1000003; // 1,000,003 is the 78,498th prime number 00018 while (*name) { 00019 sum *= *name++; // integer multiplication is a subroutine on a SPARC 00020 } 00021 return sum; // unsigned ensures positive value for use with (%) operator. 00022 }
|
|
||||||||||||
|
Definition at line 149 of file idep_nimap.cxx. References idep_NameIndexMap::length(). 00150 {
00151 int fieldWidth = 10;
00152 int maxIndex = map.length() - 1;
00153 assert (sizeof (long int) >= 4);
00154 long int x = 1000 * 1000 * 1000; // requires 4-byte integer.
00155 while (fieldWidth > 1 && 0 == maxIndex / x) {
00156 --fieldWidth;
00157 x /= 10;
00158 }
00159
00160 for (int i = 0; i < map.length(); ++i) {
00161 out.width(fieldWidth);
00162 out << i << ". " << map[i] << std::endl;
00163 }
00164
00165 return out;
00166 }
|
1.3.9.1