summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Schleef <ds@schleef.org>2012-12-02 14:52:34 -0800
committerDavid Schleef <ds@schleef.org>2012-12-02 15:09:47 -0800
commit57c3e69e19a0237b1cb97644ad09485c9f81ee2b (patch)
tree51d46f70453c911b2304ec6496ebe7b1392f7888
parent4e6fbdd81b5439d936cae300b2eb462bc077eb08 (diff)
Reindent
-rw-r--r--orc/orcarray.c262
-rw-r--r--orc/orcprofile.c56
-rw-r--r--orc/orcrandom.c22
3 files changed, 175 insertions, 165 deletions
diff --git a/orc/orcarray.c b/orc/orcarray.c
index 8773cb2..1412798 100644
--- a/orc/orcarray.c
+++ b/orc/orcarray.c
@@ -35,8 +35,7 @@
#define MISALIGNMENT 0
OrcArray *
-orc_array_new (int n, int m, int element_size, int misalignment,
- int alignment)
+orc_array_new (int n, int m, int element_size, int misalignment, int alignment)
{
OrcArray *ar;
void *data;
@@ -50,21 +49,22 @@ orc_array_new (int n, int m, int element_size, int misalignment,
static unsigned long idx = 1;
#endif
- ar = malloc (sizeof(OrcArray));
- memset (ar, 0, sizeof(OrcArray));
+ ar = malloc (sizeof (OrcArray));
+ memset (ar, 0, sizeof (OrcArray));
ar->n = n;
ar->m = m;
ar->element_size = element_size;
- ar->stride = (n*element_size + EXTEND_STRIDE);
- ar->stride = (ar->stride + (ALIGNMENT-1)) & (~(ALIGNMENT-1));
- ar->alloc_len = ar->stride * (m+2*EXTEND_ROWS) + (ALIGNMENT * element_size);
+ ar->stride = (n * element_size + EXTEND_STRIDE);
+ ar->stride = (ar->stride + (ALIGNMENT - 1)) & (~(ALIGNMENT - 1));
+ ar->alloc_len =
+ ar->stride * (m + 2 * EXTEND_ROWS) + (ALIGNMENT * element_size);
ar->alloc_len = (ar->alloc_len + 4095) & (~4095);
#ifdef USE_MMAP
- data = mmap ((void *)(idx<<32), ar->alloc_len, PROT_READ|PROT_WRITE,
- MAP_FIXED|MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
+ data = mmap ((void *) (idx << 32), ar->alloc_len, PROT_READ | PROT_WRITE,
+ MAP_FIXED | MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
idx++;
#else
#ifdef HAVE_POSIX_MEMALIGNx
@@ -73,21 +73,23 @@ orc_array_new (int n, int m, int element_size, int misalignment,
#else
data = malloc (ar->alloc_len + ALIGNMENT);
ar->alloc_data = data;
- data = (void *)((((unsigned long)data) + (ALIGNMENT-1))&(~(ALIGNMENT-1)));
+ data =
+ (void *) ((((unsigned long) data) + (ALIGNMENT - 1)) & (~(ALIGNMENT -
+ 1)));
#endif
#endif
- if (alignment == 0) alignment = element_size;
+ if (alignment == 0)
+ alignment = element_size;
offset = (alignment * misalignment) & (ALIGNMENT - 1);
- ar->data = ORC_PTR_OFFSET (ar->alloc_data,
- ar->stride * EXTEND_ROWS + offset);
+ ar->data = ORC_PTR_OFFSET (ar->alloc_data, ar->stride * EXTEND_ROWS + offset);
return ar;
}
void
-orc_array_free (OrcArray *array)
+orc_array_free (OrcArray * array)
{
#ifdef USE_MMAP
munmap (array->alloc_data, array->alloc_len);
@@ -98,13 +100,13 @@ orc_array_free (OrcArray *array)
}
void
-orc_array_set_pattern (OrcArray *array, int value)
+orc_array_set_pattern (OrcArray * array, int value)
{
memset (array->alloc_data, value, array->alloc_len);
}
void
-orc_array_set_random (OrcArray *array, OrcRandomContext *context)
+orc_array_set_random (OrcArray * array, OrcRandomContext * context)
{
orc_random_bits (context, array->alloc_data, array->alloc_len);
}
@@ -112,100 +114,102 @@ orc_array_set_random (OrcArray *array, OrcRandomContext *context)
#define CREATE_FLOAT(sign,exp,mant) (((sign)<<31)|((exp)<<23)|((mant)<<0))
static const orc_uint32 special_floats[] = {
- CREATE_FLOAT(0,0,0), /* 0 */
- CREATE_FLOAT(1,0,0), /* -0 */
- CREATE_FLOAT(0,126,0), /* 0.5 */
- CREATE_FLOAT(0,127,0), /* 1 */
- CREATE_FLOAT(0,128,0), /* 2 */
- CREATE_FLOAT(1,126,0), /* -0.5 */
- CREATE_FLOAT(1,127,0), /* -1 */
- CREATE_FLOAT(1,128,0), /* -2 */
- CREATE_FLOAT(0,255,0), /* infinity */
- CREATE_FLOAT(1,255,0), /* -infinity */
- CREATE_FLOAT(0,255,1), /* nan */
- CREATE_FLOAT(1,255,1), /* -nan */
- CREATE_FLOAT(0,0,1), /* denormal */
- CREATE_FLOAT(1,0,1), /* -denormal */
- CREATE_FLOAT(0,127+31,0), /* MAX_INT+1 */
- CREATE_FLOAT(0,127+30,0x7fffff), /* largest float < MAX_INT */
- CREATE_FLOAT(0,127+23,0x7fffff), /* largest non-integer float */
- CREATE_FLOAT(1,127+31,0), /* MIN_INT */
- CREATE_FLOAT(1,127+31,1), /* MIN_INT-1 */
- CREATE_FLOAT(1,127+30,0x7fffff), /* largest float >= MIN_INT */
- CREATE_FLOAT(1,127+23,0x7fffff), /* (negative) largest non-integer float */
- CREATE_FLOAT(0,127+14,(32767-16384)<<(23-14)), /* 32767 */
- CREATE_FLOAT(0,127+15,(0)<<(23-15)), /* 32768 */
- CREATE_FLOAT(0,127+15,(1)<<(23-15)), /* -32769 */
- CREATE_FLOAT(1,127+14,(32767-16384)<<(23-14)), /* -32767 */
- CREATE_FLOAT(1,127+15,(0)<<(23-15)), /* -32768 */
- CREATE_FLOAT(1,127+15,(1)<<(23-15)), /* -32769 */
- CREATE_FLOAT(0,127+4,(27-16)<<(23-4)), /* 27 */
- CREATE_FLOAT(0,127+4,(28-16)<<(23-4)), /* 28 */
- CREATE_FLOAT(0,127+4,(29-16)<<(23-4)), /* 29 */
- CREATE_FLOAT(0,127+4,(30-16)<<(23-4)), /* 30 */
- CREATE_FLOAT(0,127+4,(31-16)<<(23-4)), /* 31 */
+ CREATE_FLOAT (0, 0, 0), /* 0 */
+ CREATE_FLOAT (1, 0, 0), /* -0 */
+ CREATE_FLOAT (0, 126, 0), /* 0.5 */
+ CREATE_FLOAT (0, 127, 0), /* 1 */
+ CREATE_FLOAT (0, 128, 0), /* 2 */
+ CREATE_FLOAT (1, 126, 0), /* -0.5 */
+ CREATE_FLOAT (1, 127, 0), /* -1 */
+ CREATE_FLOAT (1, 128, 0), /* -2 */
+ CREATE_FLOAT (0, 255, 0), /* infinity */
+ CREATE_FLOAT (1, 255, 0), /* -infinity */
+ CREATE_FLOAT (0, 255, 1), /* nan */
+ CREATE_FLOAT (1, 255, 1), /* -nan */
+ CREATE_FLOAT (0, 0, 1), /* denormal */
+ CREATE_FLOAT (1, 0, 1), /* -denormal */
+ CREATE_FLOAT (0, 127 + 31, 0), /* MAX_INT+1 */
+ CREATE_FLOAT (0, 127 + 30, 0x7fffff), /* largest float < MAX_INT */
+ CREATE_FLOAT (0, 127 + 23, 0x7fffff), /* largest non-integer float */
+ CREATE_FLOAT (1, 127 + 31, 0), /* MIN_INT */
+ CREATE_FLOAT (1, 127 + 31, 1), /* MIN_INT-1 */
+ CREATE_FLOAT (1, 127 + 30, 0x7fffff), /* largest float >= MIN_INT */
+ CREATE_FLOAT (1, 127 + 23, 0x7fffff), /* (negative) largest non-integer float */
+ CREATE_FLOAT (0, 127 + 14, (32767 - 16384) << (23 - 14)), /* 32767 */
+ CREATE_FLOAT (0, 127 + 15, (0) << (23 - 15)), /* 32768 */
+ CREATE_FLOAT (0, 127 + 15, (1) << (23 - 15)), /* -32769 */
+ CREATE_FLOAT (1, 127 + 14, (32767 - 16384) << (23 - 14)), /* -32767 */
+ CREATE_FLOAT (1, 127 + 15, (0) << (23 - 15)), /* -32768 */
+ CREATE_FLOAT (1, 127 + 15, (1) << (23 - 15)), /* -32769 */
+ CREATE_FLOAT (0, 127 + 4, (27 - 16) << (23 - 4)), /* 27 */
+ CREATE_FLOAT (0, 127 + 4, (28 - 16) << (23 - 4)), /* 28 */
+ CREATE_FLOAT (0, 127 + 4, (29 - 16) << (23 - 4)), /* 29 */
+ CREATE_FLOAT (0, 127 + 4, (30 - 16) << (23 - 4)), /* 30 */
+ CREATE_FLOAT (0, 127 + 4, (31 - 16) << (23 - 4)), /* 31 */
};
void
-orc_array_set_pattern_2 (OrcArray *array, OrcRandomContext *context,
- int type)
+orc_array_set_pattern_2 (OrcArray * array, OrcRandomContext * context, int type)
{
- int i,j;
+ int i, j;
switch (type) {
case ORC_PATTERN_RANDOM:
orc_random_bits (context, array->alloc_data, array->alloc_len);
break;
case ORC_PATTERN_FLOAT_SMALL:
- {
- if (array->element_size != 4) return;
- for(j=0;j<array->m;j++){
- orc_union32 *data;
- int exp;
-
- data = ORC_PTR_OFFSET(array->data, array->stride * j);
-
- for(i=0;i<array->n;i++){
- data[i].i = orc_random (context);
- exp = (data[i].i & 0x7f80000) >> 23;
- exp &= 0xf;
- exp += 122;
- data[i].i &= ~0x7f800000;
- data[i].i |= (exp&0xff) << 23;
- }
+ {
+ if (array->element_size != 4)
+ return;
+ for (j = 0; j < array->m; j++) {
+ orc_union32 *data;
+ int exp;
+
+ data = ORC_PTR_OFFSET (array->data, array->stride * j);
+
+ for (i = 0; i < array->n; i++) {
+ data[i].i = orc_random (context);
+ exp = (data[i].i & 0x7f80000) >> 23;
+ exp &= 0xf;
+ exp += 122;
+ data[i].i &= ~0x7f800000;
+ data[i].i |= (exp & 0xff) << 23;
}
}
+ }
break;
case ORC_PATTERN_FLOAT_SPECIAL:
- {
- if (array->element_size != 4) return;
- for(j=0;j<array->m;j++){
- orc_union32 *data;
- int x;
-
- data = ORC_PTR_OFFSET(array->data, array->stride * j);
-
- for(i=0;i<array->n;i++){
- x = i&0x1f;
- data[i].i = special_floats[x];
- }
+ {
+ if (array->element_size != 4)
+ return;
+ for (j = 0; j < array->m; j++) {
+ orc_union32 *data;
+ int x;
+
+ data = ORC_PTR_OFFSET (array->data, array->stride * j);
+
+ for (i = 0; i < array->n; i++) {
+ x = i & 0x1f;
+ data[i].i = special_floats[x];
}
}
+ }
break;
case ORC_PATTERN_FLOAT_DENORMAL:
- {
- if (array->element_size != 4) return;
- for(j=0;j<array->m;j++){
- orc_union32 *data;
+ {
+ if (array->element_size != 4)
+ return;
+ for (j = 0; j < array->m; j++) {
+ orc_union32 *data;
- data = ORC_PTR_OFFSET(array->data, array->stride * j);
+ data = ORC_PTR_OFFSET (array->data, array->stride * j);
- for(i=0;i<array->n;i++){
- data[i].i = orc_random (context);
- data[i].i &= ~0x7f800000;
- }
+ for (i = 0; i < array->n; i++) {
+ data[i].i = orc_random (context);
+ data[i].i &= ~0x7f800000;
}
}
+ }
break;
default:
break;
@@ -216,47 +220,52 @@ orc_array_set_pattern_2 (OrcArray *array, OrcRandomContext *context,
#define MIN_NONDENORMAL_D (2.2250738585072014e-308)
int
-orc_array_compare (OrcArray *array1, OrcArray *array2, int flags)
+orc_array_compare (OrcArray * array1, OrcArray * array2, int flags)
{
if ((flags & ORC_TEST_FLAGS_FLOAT)) {
if (array1->element_size == 4) {
int j;
- for(j=0;j<array1->m;j++){
+ for (j = 0; j < array1->m; j++) {
float *a, *b;
int i;
- a = ORC_PTR_OFFSET (array1->data, j*array1->stride);
- b = ORC_PTR_OFFSET (array2->data, j*array2->stride);
+ a = ORC_PTR_OFFSET (array1->data, j * array1->stride);
+ b = ORC_PTR_OFFSET (array2->data, j * array2->stride);
- for (i=0;i<array1->n;i++){
- if (isnan(a[i]) && isnan(b[i])) continue;
- if (a[i] == b[i]) continue;
- if (fabs(a[i] - b[i]) < MIN_NONDENORMAL) continue;
+ for (i = 0; i < array1->n; i++) {
+ if (isnan (a[i]) && isnan (b[i]))
+ continue;
+ if (a[i] == b[i])
+ continue;
+ if (fabs (a[i] - b[i]) < MIN_NONDENORMAL)
+ continue;
return FALSE;
}
}
return TRUE;
} else if (array1->element_size == 8) {
int j;
- for(j=0;j<array1->m;j++){
+ for (j = 0; j < array1->m; j++) {
double *a, *b;
int i;
- a = ORC_PTR_OFFSET (array1->data, j*array1->stride);
- b = ORC_PTR_OFFSET (array2->data, j*array2->stride);
+ a = ORC_PTR_OFFSET (array1->data, j * array1->stride);
+ b = ORC_PTR_OFFSET (array2->data, j * array2->stride);
- for (i=0;i<array1->n;i++){
- if (isnan(a[i]) && isnan(b[i])) continue;
- if (a[i] == b[i]) continue;
- if (abs(a[i] - b[i]) < MIN_NONDENORMAL_D) continue;
+ for (i = 0; i < array1->n; i++) {
+ if (isnan (a[i]) && isnan (b[i]))
+ continue;
+ if (a[i] == b[i])
+ continue;
+ if (abs (a[i] - b[i]) < MIN_NONDENORMAL_D)
+ continue;
return FALSE;
}
}
return TRUE;
}
} else {
- if (memcmp (array1->alloc_data, array2->alloc_data,
- array1->alloc_len) == 0) {
+ if (memcmp (array1->alloc_data, array2->alloc_data, array1->alloc_len) == 0) {
return TRUE;
}
}
@@ -265,25 +274,26 @@ orc_array_compare (OrcArray *array1, OrcArray *array2, int flags)
}
int
-orc_array_check_out_of_bounds (OrcArray *array)
+orc_array_check_out_of_bounds (OrcArray * array)
{
int i;
int j;
unsigned char *data;
-
+
data = array->alloc_data;
- for(i=0;i<array->stride * EXTEND_ROWS;i++){
+ for (i = 0; i < array->stride * EXTEND_ROWS; i++) {
if (data[i] != ORC_OOB_VALUE) {
- printf("OOB check failed at start-%d\n", array->stride * EXTEND_ROWS - i);
+ printf ("OOB check failed at start-%d\n",
+ array->stride * EXTEND_ROWS - i);
return FALSE;
}
}
- for(j=0;j<array->m;j++){
- data = ORC_PTR_OFFSET(array->data, array->stride * j);
- for(i=array->element_size * array->n;i<array->stride;i++){
+ for (j = 0; j < array->m; j++) {
+ data = ORC_PTR_OFFSET (array->data, array->stride * j);
+ for (i = array->element_size * array->n; i < array->stride; i++) {
if (data[i] != ORC_OOB_VALUE) {
- printf("OOB check failed on row %d, end+%d\n", j,
+ printf ("OOB check failed on row %d, end+%d\n", j,
i - array->element_size * array->n);
return FALSE;
}
@@ -291,9 +301,9 @@ orc_array_check_out_of_bounds (OrcArray *array)
}
data = ORC_PTR_OFFSET (array->data, array->stride * array->m);
- for(i=0;i<array->stride * EXTEND_ROWS;i++){
+ for (i = 0; i < array->stride * EXTEND_ROWS; i++) {
if (data[i] != ORC_OOB_VALUE) {
- printf("OOB check failed at end+%d\n", i);
+ printf ("OOB check failed at end+%d\n", i);
return FALSE;
}
}
@@ -303,35 +313,35 @@ orc_array_check_out_of_bounds (OrcArray *array)
#if 0
void
-orc_array_print_compare (OrcArray *array1, OrcArray *array2)
+orc_array_print_compare (OrcArray * array1, OrcArray * array2)
{
- for(j=0;j<array1->m;j++){
- for(i=0;i<array1->n;i++){
- int a,b;
+ for (j = 0; j < array1->m; j++) {
+ for (i = 0; i < array1->n; i++) {
+ int a, b;
int j;
- printf("%2d %2d:", i, j);
+ printf ("%2d %2d:", i, j);
- for(k=0;k<ORC_N_VARIABLES;k++){
- if (program->vars[k].name == NULL) continue;
+ for (k = 0; k < ORC_N_VARIABLES; k++) {
+ if (program->vars[k].name == NULL)
+ continue;
if (program->vars[k].vartype == ORC_VAR_TYPE_SRC &&
program->vars[k].size > 0) {
print_array_val_signed (ex->arrays[k], program->vars[k].size, i);
}
}
- printf(" ->");
+ printf (" ->");
a = print_array_val_signed (dest_emul[k], program->vars[k].size, i);
b = print_array_val_signed (dest_exec[k], program->vars[k].size, i);
if (a != b) {
- printf(" *");
+ printf (" *");
}
- printf("\n");
+ printf ("\n");
}
}
}
#endif
-
diff --git a/orc/orcprofile.c b/orc/orcprofile.c
index 131448a..9ce3bb6 100644
--- a/orc/orcprofile.c
+++ b/orc/orcprofile.c
@@ -57,21 +57,21 @@
* Initializes a profiling structure.
*/
void
-orc_profile_init (OrcProfile *prof)
+orc_profile_init (OrcProfile * prof)
{
#if defined(__GNUC__) && defined(HAVE_ARM) && defined(USE_CORTEX_A8_COUNTER)
unsigned int flags;
- __asm__ volatile ("mrc p15, 0, %0, c9, c12, 0" : "=r" (flags));
+ __asm__ volatile ("mrc p15, 0, %0, c9, c12, 0":"=r" (flags));
flags |= 1;
- __asm__ volatile ("mcr p15, 0, %0, c9, c12, 0" :: "r" (flags));
+ __asm__ volatile ("mcr p15, 0, %0, c9, c12, 0"::"r" (flags));
- __asm__ volatile ("mcr p15, 0, %0, c9, c12, 2" :: "r"(1<<31));
- __asm__ __volatile__(" mcr p15, 0, %0, c9, c13, 0" :: "r" (0));
+ __asm__ volatile ("mcr p15, 0, %0, c9, c12, 2"::"r" (1 << 31));
+ __asm__ __volatile__ (" mcr p15, 0, %0, c9, c13, 0"::"r" (0));
- __asm__ volatile ("mcr p15, 0, %0, c9, c12, 1" :: "r"(1<<31));
+ __asm__ volatile ("mcr p15, 0, %0, c9, c12, 1"::"r" (1 << 31));
#endif
- memset(prof, 0, sizeof(OrcProfile));
+ memset (prof, 0, sizeof (OrcProfile));
prof->min = -1;
@@ -86,7 +86,7 @@ orc_profile_init (OrcProfile *prof)
* FIXME: need more info
*/
void
-orc_profile_stop_handle (OrcProfile *prof)
+orc_profile_stop_handle (OrcProfile * prof)
{
int i;
@@ -95,9 +95,10 @@ orc_profile_stop_handle (OrcProfile *prof)
prof->total += prof->last;
prof->n++;
- if (prof->last < prof->min) prof->min = prof->last;
-
- for(i=0;i<prof->hist_n;i++) {
+ if (prof->last < prof->min)
+ prof->min = prof->last;
+
+ for (i = 0; i < prof->hist_n; i++) {
if (prof->last == prof->hist_time[i]) {
prof->hist_count[i]++;
break;
@@ -122,7 +123,7 @@ orc_profile_stop_handle (OrcProfile *prof)
* be NULL, in which case the values will not be written.
*/
void
-orc_profile_get_ave_std (OrcProfile *prof, double *ave_p, double *std_p)
+orc_profile_get_ave_std (OrcProfile * prof, double *ave_p, double *std_p)
{
double ave;
double std;
@@ -138,7 +139,7 @@ orc_profile_get_ave_std (OrcProfile *prof, double *ave_p, double *std_p)
s = s2 = 0;
n = 0;
max_i = -1;
- for(i=0;i<10;i++){
+ for (i = 0; i < 10; i++) {
x = prof->hist_time[i];
s2 += x * x * prof->hist_count[i];
s += x * prof->hist_count[i];
@@ -151,16 +152,18 @@ orc_profile_get_ave_std (OrcProfile *prof, double *ave_p, double *std_p)
}
ave = s / n;
- std = sqrt (s2 - s * s / n + n*n) / (n-1);
- off = (prof->hist_time[max_i] - ave)/std;
+ std = sqrt (s2 - s * s / n + n * n) / (n - 1);
+ off = (prof->hist_time[max_i] - ave) / std;
if (off > 4.0) {
prof->hist_count[max_i] = 0;
}
} while (off > 4.0);
- if (ave_p) *ave_p = ave;
- if (std_p) *std_p = std;
+ if (ave_p)
+ *ave_p = ave;
+ if (std_p)
+ *std_p = std;
}
@@ -169,33 +172,31 @@ oil_profile_stamp_default (void)
{
#if defined(__GNUC__) && (defined(HAVE_I386) || defined(HAVE_AMD64))
unsigned long ts;
- __asm__ __volatile__("rdtsc\n" : "=a" (ts) : : "edx");
+ __asm__ __volatile__ ("rdtsc\n":"=a" (ts)::"edx");
return ts;
#elif defined(__GNUC__) && defined(HAVE_ARM) && defined(USE_CORTEX_A8_COUNTER)
unsigned int ts;
//__asm__ __volatile__(" mrc p14, 0, %0, c1, c0, 0 \n" : "=r" (ts));
- __asm__ __volatile__(" mrc p15, 0, %0, c9, c13, 0 \n" : "=r" (ts));
+ __asm__ __volatile__ (" mrc p15, 0, %0, c9, c13, 0 \n":"=r" (ts));
return ts;
#elif defined(_MSC_VER) && defined(HAVE_I386)
unsigned long ts;
__asm push edx
- __asm __emit 0fh __asm __emit 031h
- __asm mov ts, eax
- __asm pop edx
+ __asm __emit 0f h __asm __emit 031 h __asm mov ts, eax __asm pop edx
#elif defined(HAVE_CLOCK_GETTIME) && defined(HAVE_MONOTONIC_CLOCK)
struct timespec ts;
clock_gettime (CLOCK_MONOTONIC, &ts);
- return 1000000000*ts.tv_sec + ts.tv_nsec;
+ return 1000000000 * ts.tv_sec + ts.tv_nsec;
#elif defined(HAVE_GETTIMEOFDAY)
struct timeval tv;
- gettimeofday(&tv,NULL);
- return 1000000*(unsigned long)tv.tv_sec + (unsigned long)tv.tv_usec;
+ gettimeofday (&tv, NULL);
+ return 1000000 * (unsigned long) tv.tv_sec + (unsigned long) tv.tv_usec;
#else
return 0;
#endif
}
-static unsigned long (*_orc_profile_stamp)(void) = oil_profile_stamp_default;
+static unsigned long (*_orc_profile_stamp) (void) = oil_profile_stamp_default;
/**
* orc_profile_stamp:
@@ -208,7 +209,7 @@ static unsigned long (*_orc_profile_stamp)(void) = oil_profile_stamp_default;
unsigned long
orc_profile_stamp (void)
{
- return _orc_profile_stamp();
+ return _orc_profile_stamp ();
}
void
@@ -216,4 +217,3 @@ _orc_profile_init (void)
{
}
-
diff --git a/orc/orcrandom.c b/orc/orcrandom.c
index ef7a0a5..95abc88 100644
--- a/orc/orcrandom.c
+++ b/orc/orcrandom.c
@@ -9,7 +9,7 @@
void
-orc_random_init (OrcRandomContext *context, int seed)
+orc_random_init (OrcRandomContext * context, int seed)
{
context->x = seed;
@@ -19,29 +19,29 @@ orc_random_init (OrcRandomContext *context, int seed)
void
-orc_random_bits (OrcRandomContext *context, void *data, int n_bytes)
+orc_random_bits (OrcRandomContext * context, void *data, int n_bytes)
{
orc_uint8 *d = data;
int i;
- for(i=0;i<n_bytes;i++){
- context->x = 1103515245*context->x + 12345;
- d[i] = context->x>>16;
+ for (i = 0; i < n_bytes; i++) {
+ context->x = 1103515245 * context->x + 12345;
+ d[i] = context->x >> 16;
}
}
void
-orc_random_floats (OrcRandomContext *context, float *data, int n)
+orc_random_floats (OrcRandomContext * context, float *data, int n)
{
int i;
- for(i=0;i<n;i++){
- context->x = 1103515245*context->x + 12345;
- data[i] = (double)(context->x>>16) / 32768.0 - 1.0;
+ for (i = 0; i < n; i++) {
+ context->x = 1103515245 * context->x + 12345;
+ data[i] = (double) (context->x >> 16) / 32768.0 - 1.0;
}
}
unsigned int
-orc_random (OrcRandomContext *context)
+orc_random (OrcRandomContext * context)
{
- context->x = 1103515245*context->x + 12345;
+ context->x = 1103515245 * context->x + 12345;
return context->x;
}