diff options
| author | Florian Fischer <florian.fl.fischer@fau.de> | 2020-05-06 16:56:32 +0200 |
|---|---|---|
| committer | Florian Fischer <florian.fl.fischer@fau.de> | 2020-06-02 11:18:47 +0200 |
| commit | 8174a918ea3b7cb216bf7ea98cfdc10661b5c37d (patch) | |
| tree | 0747ec3ccb9f8d7eeccfac35977fc17855ca3bbb /src/benchmarks/cfrac/pdefs.h | |
| parent | 8f52e8fc02dd235582f5961941bcd564e9a681cd (diff) | |
| download | allocbench-8174a918ea3b7cb216bf7ea98cfdc10661b5c37d.tar.gz allocbench-8174a918ea3b7cb216bf7ea98cfdc10661b5c37d.zip | |
make the whole project more python idiomatic
* rename src directory to allocbench
* make global variable names UPPERCASE
* format a lot of code using yapf
* use lowercase ld_preload and ld_library_path as Allocator members
* name expected Errors 'err' and don't raise a new Exception
* disable some pylint messages
Diffstat (limited to 'src/benchmarks/cfrac/pdefs.h')
| -rw-r--r-- | src/benchmarks/cfrac/pdefs.h | 138 |
1 files changed, 0 insertions, 138 deletions
diff --git a/src/benchmarks/cfrac/pdefs.h b/src/benchmarks/cfrac/pdefs.h deleted file mode 100644 index 9c43099..0000000 --- a/src/benchmarks/cfrac/pdefs.h +++ /dev/null @@ -1,138 +0,0 @@ -/* - * +------------------------------------------------------------------+ - * | Private Math Library Definitions | - * +------------------------------------------------------------------+ - */ -/* - * Optional assembly language - */ -#ifdef ASM -#include "machineop.h" /* 16-bit integer machine operations */ -#define uModDiv(n, d, qp) umoddiv16(n, d, qp) /* slight help */ -#else -#define uModDiv(n, d, qp) (*(qp) = (n) / (d), (n) % (d)) -#endif -#define uMul(u, v) ((u) * (v)) /* fast enough */ - -/* - * Optional alternate memory allocator - */ - -#ifndef MYALLOC - -# if defined(BWGC) -extern char *gc_malloc_atomic(); -#define allocate(size) (char *) gc_malloc_atomic(size) -# elif defined(CUSTOM_MALLOC) -#define allocate(size) CUSTOM_MALLOC(size) -# else -/* extern char *malloc(); */ -#define allocate(size) (char *) malloc(size) -# endif - -#ifdef IGNOREFREE -#define deallocate(p) {}; -# elif defined(CUSTOM_FREE) -#define deallocate(p) CUSTOM_FREE(p) -#else -/* -extern int free(); -*/ -#define deallocate(p) free(p) -#endif - -#else -extern char *allocate(); -extern void deallocate(); -#endif - -/* - * These next four types are used only used in this include file - */ -#include <stdint.h> -typedef unsigned char u8; /* 8 bits */ -typedef uint16_t u16; /* 16 bits */ -typedef uint32_t u32; /* 32 bits */ -typedef u8 boolean; /* 1 bit */ - -#define BASE 65536 /* Base * (Base-1) <= MAXINT */ - -/* - * Operations on Base (unsigned math) - */ -#define modBase(u) ((u) & 0xffff) /* remainder on Base */ -#define divBase(u) ((u) >> 16) /* divide by Base */ -#define mulBase(u) ((u) << 16) /* multiply by Base */ - -/* - * The type of a variable used to store intermediate results. - * This should be the most efficient unsigned int on your machine. - */ -typedef u32 accumulator; /* 0..(Base * Base) - 1 */ - -/* - * The type of a single digit - */ -typedef u16 digit; /* 0..Base-1 */ - -/* - * The type of a digit index (the largest number of digits - 1) - * Determines the maximum representable precision (not usually changed) - */ -typedef u16 posit; /* 0..size */ - -typedef unsigned short prefc; /* in precision.h also */ -/* - * End of area which needs to be modified - */ - -#define false 0 -#define true 1 - -typedef digit digitString[1]; /* dummy array type */ -typedef digit *digitPtr; - -/* - * A normalized integer has the following attributes: - * -0 cannot occur - * all digits >= size assumed to be 0. (no leading zero's) - * size > 0 - */ -typedef struct { -#ifndef BWGC - prefc refcount; /* reference count (must be 1st [for pref]) */ -#endif - posit alloc; /* allocated size */ - posit size; /* number of digits */ - boolean sign; /* sign: TRUE negative */ - digitString value; -} precisionType; - -typedef precisionType *precision; - -/* - * Overlay for cache of precisions - */ -typedef struct { - precision next; /* next item in list */ - short count; /* number of items in this sublist */ -} cacheType; - -typedef cacheType *cachePtr; -/* - * Maximum total memory consumed by cache = - * LIMIT * (1 + SIZE * (PrecisionSize + sizeof(digit) * (SIZE-1) / 2)) - */ -#ifndef CACHESIZE -#define CACHESIZE 32 /* size of allocation cache */ -#endif -#define CACHELIMIT 128 /* Determines max mem used by cache */ - -#define PrecisionSize (sizeof(precisionType) - sizeof(digitString)) - -/* - * Function definitions are all in the global include file "mathdefs.h". - */ -extern precision palloc(); /* semi-private */ -extern int pfree(); /* semi-private */ -extern void pnorm(); /* semi-private */ |
