-
Notifications
You must be signed in to change notification settings - Fork 13
/
nmglobal.h
519 lines (454 loc) · 12.6 KB
/
nmglobal.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
/*
** nmglobal.h
** Global definitions for native mode benchmarks.
**
** BYTEmark (tm)
** BYTE's Native Mode Benchmarks
** Rick Grehan, BYTE Magazine
**
** Creation:
** Revision: 3/95;10/95
** 10/95 - Added memory array & alignment -- RG
**
** DISCLAIMER
** The source, executable, and documentation files that comprise
** the BYTEmark benchmarks are made available on an "as is" basis.
** This means that we at BYTE Magazine have made every reasonable
** effort to verify that the there are no errors in the source and
** executable code. We cannot, however, guarantee that the programs
** are error-free. Consequently, McGraw-HIll and BYTE Magazine make
** no claims in regard to the fitness of the source code, executable
** code, and documentation of the BYTEmark.
** Furthermore, BYTE Magazine, McGraw-Hill, and all employees
** of McGraw-Hill cannot be held responsible for any damages resulting
** from the use of this code or the results obtained from using
** this code.
*/
/* is this a 64 bit architecture? If so, this will define LONG64 */
#include "pointer.h"
/*
** SYSTEM DEFINES
*/
/* +++ MEMORY +++ */
/*
** You must define ONLY ONE of the following identifiers
** to specify the mechanism for allocating memory:
** MALLOCMEM
** DOS16MEM
** MACMEM
*/
/*
** Define MALLOCMEM to use the standard malloc() call for
** memory. This is the default for most systems.
*/
#define MALLOCMEM
/*
** Define DOS16MEM if you're running in the old 16-bit segmented
** model. This enables some fruity memory management routines
** required for that model. NOT defining this assumes that
** you're running in an environment that allows malloc() to
** get > 64K chunks of memory.
*/
/* #define DOS16MEM */
/* Define MACMEM to use the Mac's GetPtr call to allocate
** memory (instead of malloc()).
*/
/* #define MACMEM */
/* +++ TIMING +++ */
/*
** You must define ONLY ONE of the following identifiers to pick
** the timing routine used.
** CLOCKWCPS
** CLOCKWCT
** MACTIMEMGR
** WIN31TIMER
*/
/*
** Define CLOCKWCPS if you are using the clock() routine and the
** constant used as the divisor to determine seconds is
** CLOCKS_PER_SEC. This is the default in most cases.
*/
#define CLOCKWCPS
/*
** Define CLOCKWCT if you are using the clock() routine and the
** constant used as the divisor to determine seconds is CLK_TCK
*/
/* #define CLOCKWCT */
/*
** Define MACTIMEMGR to use the Mac Time manager routines.
** You'll need to be running at least system 6.0.3 or
** better...extended time manager is recommended (system 7 or
** better).
*/
/* #define MACTIMEMGR */
/*
** Define WIN31TIMER to user the timing routines in TOOLHELP.DLL.
** Gets accuracy down to the millisecond.
*/
/* #define WIN31TIMER */
/* +++ MISCELLANEOUS +++ */
/*
** Define DOS16 if you'll be compiling under DOS in 16-bit
** (non DOS-extended) mode. This will enable proper definitions
** for the far*** typedefs
*/
/* #define DOS16 */
/*
** Define MAC if you're compiling on a Macintosh. This
** does a number of things:
** includes unix.h
** Incorporates code to mimic the command line via either
** the console library (Symantec/Think) or the SIOUX
** library (Code Warrior).
*/
/* #define MAC */
/*
** Define LONG64 if your compiler emits 64-bit longs.
** This is typically true of Alpha compilers on Unix
** systems...though, who knows, this may change in the
** future. I MOVED THIS DEFINTION INTO THE FILE pointer.h. DO NOT
** DEFINE IT HERE. IT WILL AUTOMATICALLY BE DEFINED IF NECESSARY.
** Uwe F. Mayer, Dec 15, 1996, Nov 15, 1997
*/
/* #define LONG64 */
/*
** Define MACCWPROF if you are profiling on the Mac using
** Code Warrior. This enables code that turns off the
** profiler in an evern of an error exit.
*/
/* #define MACCWPROF */
#ifdef MAC
#include <unix.h>
#endif
/*
** ERROR CODES
*/
#define ERROR_MEMORY 1
#define ERROR_MEMARRAY_FULL 2
#define ERROR_MEMARRAY_NFOUND 3
#define ERROR_FILECREATE 10
#define ERROR_FILEREAD 11
#define ERROR_FILEWRITE 12
#define ERROR_FILEOPEN 13
#define ERROR_FILESEEK 14
/*
** MINIMUM_TICKS
**
** This sets the default number of minimum ticks.
** It can, of course, be overridden by the input
** command file.
** This ultimately gets loaded into the variable
** global_min_ticks, which specifies the minimum
** number of ticks that must take place between
** a StartStopwatch() and StopStopwatch() call.
** The idea is to reduce error buildup.
*/
#define MINIMUM_TICKS 60
/*
** MINIMUM_SECONDS
**
** Minimum number of seconds to run each test.
*/
#define MINIMUM_SECONDS 5
/*
** MAXPOSLONG
**
** This is the maximum positive long.
*/
#ifdef LONG64
#define MAXPOSLONG 0x7FFFFFFFFFFFFFFFL
#else
#define MAXPOSLONG 0x7FFFFFFFL
#endif
/*
** OTHER DEFINES
*/
#ifndef MAC
#define TRUE 1
#define FALSE 0
#endif
/*
** Memory array size. Used in SYSSPEC for keeping track
** of re-aligned memory.
*/
#define MEM_ARRAY_SIZE 20
/*
** TYPEDEFS
*/
#define ulong unsigned long
#define uchar unsigned char
#define uint unsigned int
#define ushort unsigned short
/*
typedef unsigned char uchar;
typedef unsigned int uint;
typedef unsigned short ushort;
typedef unsigned long ulong;
*/
/*
** The 'farxxx' typedefs were added in deference to DOS, which
** requires far pointers to handle some of the bigger
** memory structures. Other systems will simply
** map 'farxxx' to 'xxx'
*/
#ifdef DOS16
typedef void huge farvoid;
typedef double huge fardouble;
typedef long huge farlong;
typedef unsigned long huge farulong;
typedef char huge farchar;
typedef unsigned char huge faruchar;
#else
typedef void farvoid;
typedef double fardouble;
typedef long farlong;
typedef unsigned long farulong;
typedef char farchar;
typedef unsigned char faruchar;
#endif
/*
** The following typedefs are used when element size
** is critical. You'll have to alter these for
** your specifical platform/compiler.
*/
typedef unsigned char u8; /* Unsigned 8-bits */
typedef unsigned short u16; /* Unsigned 16 bits */
#ifdef LONG64
typedef unsigned int u32; /* Unsigned 32 bits */
typedef int int32; /* Signed 32 bit integer */
#else
typedef unsigned long u32; /* Unsigned 32 bits */
typedef long int32; /* Signed 32 bit integer */
#endif
/*****************
** NUMERIC SORT **
*****************/
/*
** DEFINES
*/
/*
** The following constant, NUMNUMARRAYS (no, it is not a
** Peter Sellers joke) is the maximum number of arrays
** that can be built by the numeric sorting benchmark
** before it gives up. This maximum is dependent on the
** amount of memory in the system.
*/
/*#define NUMNUMARRAYS 1000*/
#define NUMNUMARRAYS 10000
/*
** The following constant NUMARRAYSIZE determines the
** default # of elements in each numeric array. Ordinarily
** this is something you shouldn't fool with, though as
** with most of the constants here, it is adjustable.
*/
#define NUMARRAYSIZE 8111L
/*
** TYPEDEFS
*/
typedef struct {
int adjust; /* Set adjust code */
ulong request_secs; /* # of seconds requested */
double sortspersec; /* # of sort iterations per sec */
ushort numarrays; /* # of arrays */
ulong arraysize; /* # of elements in array */
} SortStruct;
/****************
** STRING SORT **
*****************
** Note: The string sort benchmark uses the same structure to
** communicate parameters as does the numeric sort benchmark.
** (i.e., SortStruct...see above.
*/
/*
** DEFINES
*/
/*
** The following constant STRINGARRAYSIZE determines
** the default # of bytes allocated to each string array.
** Though the actual size can be pre-set from the command
** file, this constant should be left unchanged.
*/
#define STRINGARRAYSIZE 8111L
/************************
** BITFIELD OPERATIONS **
*************************
*/
/*
** DEFINES
*/
/*
** Following field sets the size of the bitfield array (in longs).
*/
#ifdef LONG64
#define BITFARRAYSIZE 16384L
#else
#define BITFARRAYSIZE 32768L
#endif
/*
** TYPEDEFS
*/
typedef struct {
int adjust; /* Set adjust code */
ulong request_secs; /* # of seconds requested */
double bitopspersec; /* # of bitfield ops per sec */
ulong bitoparraysize; /* Total # of bitfield ops */
ulong bitfieldarraysize; /* Bit field array size */
} BitOpStruct;
/****************************
** EMULATED FLOATING POINT **
****************************/
/*
** DEFINES
*/
#define INTERNAL_FPF_PRECISION 4
/*
** The following constant is the maximum number of loops
** of the emulated floating point test that the system
** will allow before flagging an error. This is not a
** critical constant, and can be altered if your system is
** a real barn-burner.
*/
/*#define CPUEMFLOATLOOPMAX 50000L*/
#define CPUEMFLOATLOOPMAX 500000L
/*
** Set size of array
*/
#define EMFARRAYSIZE 3000L
/*
** TYPEDEFS
*/
typedef struct {
int adjust; /* Set adjust code */
ulong request_secs; /* # of seconds requested */
ulong arraysize; /* Size of array */
ulong loops; /* Loops per iterations */
double emflops; /* Results */
} EmFloatStruct;
/*************************
** FOURIER COEFFICIENTS **
*************************/
/*
** TYPEDEFS
*/
typedef struct {
int adjust; /* Set adjust code */
ulong request_secs; /* # of requested seconds */
ulong arraysize; /* Size of coeff. arrays */
double fflops; /* Results */
} FourierStruct;
/*************************
** ASSIGNMENT ALGORITHM **
*************************/
/*
** TYPEDEFS
*/
typedef struct {
int adjust; /* Set adjust code */
ulong request_secs; /* Requested # of seconds */
ulong numarrays; /* # of arrays */
double iterspersec; /* Results */
} AssignStruct;
/********************
** IDEA ENCRYPTION **
********************/
/*
** DEFINES
*/
/* Following constant defines the max number of loops the
** system will attempt. Keeps things from going off into the
** weeds. */
/*#define MAXIDEALOOPS 50000L*/
#define MAXIDEALOOPS 500000L
/*
** Following constant sets the size of the arrays.
** NOTE: For the IDEA algorithm to work properly, this
** number MUST be some multiple of 8.
*/
#define IDEAARRAYSIZE 4000L
/*
** TYPEDEFS
*/
typedef struct {
int adjust; /* Set adjust code */
ulong request_secs; /* Requested # of seconds */
ulong arraysize; /* Size of array */
ulong loops; /* # of times to convert */
double iterspersec; /* Results */
} IDEAStruct;
/************************
** HUFFMAN COMPRESSION **
************************/
/*
** DEFINES
*/
/*
** MAXHUFFLOOPS
**
** This constant specifies the maximum number of Huffman
** compression loops the system will try for. This keeps
** the test from going off into the weeds. This is not
** a critical constant, and can be increased if your
** system is a real barn-burner.
*/
/*#define MAXHUFFLOOPS 50000L*/
#define MAXHUFFLOOPS 500000L
/*
** Following constant sets the size of the arrays to
** be compressed/uncompressed.
*/
#define HUFFARRAYSIZE 5000L
/*
** TYPEDEFS
*/
typedef struct {
int adjust; /* Set adjust code */
ulong request_secs; /* Requested # of seconds */
ulong arraysize; /* Size of array */
ulong loops; /* # of times to compress/decompress */
double iterspersec; /* Results */
} HuffStruct;
/********************************
** BACK PROPAGATION NEURAL NET **
********************************/
/*
** MAXNNETLOOPS
**
** This constant sets the max number of loops through the neural
** net that the system will attempt before giving up. This
** is not a critical constant. You can alter it if your system
** has sufficient horsepower.
*/
/*#define MAXNNETLOOPS 50000L*/
#define MAXNNETLOOPS 500000L
/*
** TYPEDEFS
*/
typedef struct {
int adjust; /* Set adjust code */
ulong request_secs; /* Requested # of seconds */
ulong loops; /* # of times to learn */
double iterspersec; /* Results */
} NNetStruct;
/***********************
** LU DECOMPOSITION **
** (Linear Equations) **
***********************/
/*
** MAXLUARRAYS
**
** This sets the upper limit on the number of arrays
** that the benchmark will attempt to build before
** flagging an error. It is not a critical constant, and
** may be increased if your system has the horsepower.
*/
/*#define MAXLUARRAYS 1000*/
#define MAXLUARRAYS 10000
/*
** TYPEDEFS
*/
typedef struct {
int adjust; /* Set adjust code */
ulong request_secs; /* Requested # of seconds */
ulong numarrays; /* # of arrays */
double iterspersec; /* Results */
} LUStruct;