diff options
-rw-r--r-- | examples/volscale.c | 7 | ||||
-rw-r--r-- | orc-float/orcfloat.c | 2 | ||||
-rw-r--r-- | orc-pixel/orcpixel.c | 2 | ||||
-rw-r--r-- | orc-test/orcarray.c | 8 | ||||
-rw-r--r-- | orc-test/orctest.c | 4 | ||||
-rw-r--r-- | orc/orcarm.c | 17 | ||||
-rw-r--r-- | orc/orccodemem.c | 2 | ||||
-rw-r--r-- | orc/orccpu-x86.c | 15 | ||||
-rw-r--r-- | orc/orcmmx.c | 1 | ||||
-rw-r--r-- | orc/orcopcodes.c | 2 | ||||
-rw-r--r-- | orc/orcpowerpc.c | 1 | ||||
-rw-r--r-- | orc/orcprogram-altivec.c | 1 | ||||
-rw-r--r-- | orc/orcprogram-arm.c | 1 | ||||
-rw-r--r-- | orc/orcprogram-mmx.c | 1 | ||||
-rw-r--r-- | orc/orcprogram-sse.c | 1 | ||||
-rw-r--r-- | orc/orcrules-altivec.c | 3 | ||||
-rw-r--r-- | orc/orcrules-arm.c | 1 | ||||
-rw-r--r-- | orc/orcrules-mmx.c | 1 | ||||
-rw-r--r-- | orc/orcrules-sse.c | 1 | ||||
-rw-r--r-- | orc/orcsse.c | 1 | ||||
-rw-r--r-- | orc/orcutils.c | 1 | ||||
-rw-r--r-- | orc/orcx86.c | 1 |
22 files changed, 43 insertions, 31 deletions
diff --git a/examples/volscale.c b/examples/volscale.c index 5aa4ec0..1f02b99 100644 --- a/examples/volscale.c +++ b/examples/volscale.c @@ -1,7 +1,8 @@ #include <stdio.h> -#include <stdint.h> +#ifndef _MSC_VER #include <sys/time.h> +#endif #define ORC_ENABLE_UNSTABLE_API @@ -193,11 +194,15 @@ do_volume_orc (int16_t *dest, int32_t *volumes, int16_t *samp, int length) static uint64_t get_timestamp () { +#ifndef _MSC_VER struct timeval now; gettimeofday (&now, NULL); return now.tv_sec * 1000000LL + now.tv_usec; +#else + return 0; +#endif } #define TIMES 100000 diff --git a/orc-float/orcfloat.c b/orc-float/orcfloat.c index 98f9277..c4db586 100644 --- a/orc-float/orcfloat.c +++ b/orc-float/orcfloat.c @@ -8,7 +8,7 @@ #include <string.h> #include <math.h> -static OrcStaticOpcode opcodes[]; +extern OrcStaticOpcode opcodes[]; void orc_float_sse_register_rules (void); diff --git a/orc-pixel/orcpixel.c b/orc-pixel/orcpixel.c index da38b8c..6d2adce 100644 --- a/orc-pixel/orcpixel.c +++ b/orc-pixel/orcpixel.c @@ -7,7 +7,7 @@ #include <stdlib.h> #include <string.h> -static OrcStaticOpcode opcodes[]; +extern OrcStaticOpcode opcodes[]; void orc_pixel_sse_register_rules (void); diff --git a/orc-test/orcarray.c b/orc-test/orcarray.c index 98b649e..3c47262 100644 --- a/orc-test/orcarray.c +++ b/orc-test/orcarray.c @@ -16,6 +16,10 @@ #define OOB_VALUE 0xa5 +#ifdef _MSC_VER +#define isnan(x) _isnan(x) +#endif + OrcArray * orc_array_new (int n, int m, int element_size) { @@ -102,7 +106,7 @@ orc_array_check_out_of_bounds (OrcArray *array) } for(j=0;j<array->m;j++){ - data = array->data + array->stride * j; + data = ORC_PTR_OFFSET(array->data, array->stride * j); for(i=array->element_size * array->n;i<array->stride;i++){ if (data[i] != OOB_VALUE) { printf("OOB check failed on row %d, end+%d\n", j, @@ -112,7 +116,7 @@ orc_array_check_out_of_bounds (OrcArray *array) } } - data = array->data + array->stride * array->m; + data = ORC_PTR_OFFSET (array->data, array->stride * array->m); for(i=0;i<array->stride * EXTEND_ROWS;i++){ if (data[i] != OOB_VALUE) { printf("OOB check failed at end+%d\n", i); diff --git a/orc-test/orctest.c b/orc-test/orctest.c index 944959d..4be250c 100644 --- a/orc-test/orctest.c +++ b/orc-test/orctest.c @@ -13,6 +13,10 @@ #include <string.h> #include <math.h> +#ifdef _MSC_VER +#define isnan(x) _isnan(x) +#endif + void _orc_profile_init(void); OrcRandomContext rand_context; diff --git a/orc/orcarm.c b/orc/orcarm.c index 8115800..630b811 100644 --- a/orc/orcarm.c +++ b/orc/orcarm.c @@ -7,7 +7,6 @@ #include <string.h> #include <stdlib.h> -#include <unistd.h> #include <sys/types.h> #include <orc/orcdebug.h> @@ -463,30 +462,30 @@ orc_arm_emit_dp (OrcCompiler *p, int type, OrcArmCond cond, OrcArmDP opcode, return; } shifter_op = arm_so_i (shift, imm); - snprintf (shifter, sizeof(shifter), "#0x%08x", val); + sprintf (shifter, "#0x%08x", val); I = 1; break; case 1: /* <Rm> */ shifter_op = arm_so_r (Rm); - snprintf (shifter, sizeof(shifter), "%s", orc_arm_reg_name (Rm)); + sprintf (shifter, "%s", orc_arm_reg_name (Rm)); break; case 2: /* <Rm>, [LSL|LSR|ASR] #imm */ shifter_op = arm_so_rsi (val,shift,Rm); - snprintf (shifter, sizeof(shifter), "%s, %s #%d", + sprintf (shifter, "%s, %s #%d", orc_arm_reg_name (Rm), shift_names[shift], val); break; case 3: /* <Rm>, [LSL|LSR|ASR] <Rs> */ shifter_op = arm_so_rsr (val,shift,Rm); - snprintf (shifter, sizeof(shifter), "%s, %s %s", + sprintf (shifter, "%s, %s %s", orc_arm_reg_name (Rm), shift_names[shift], orc_arm_reg_name (val)); break; case 4: /* <Rm>, RRX */ shifter_op = arm_so_rrx (Rm); - snprintf (shifter, sizeof(shifter), "%s, RRX", + sprintf (shifter, "%s, RRX", orc_arm_reg_name (Rm)); break; default: @@ -577,7 +576,7 @@ orc_arm_emit_xt (OrcCompiler *p, int op, OrcArmCond cond, }; if (r8 & 0x18) - snprintf (shifter, sizeof (shifter), ", ROR #%d", r8 & 0x18); + sprintf (shifter, sizeof (shifter), ", ROR #%d", r8 & 0x18); else shifter[0] = '\0'; @@ -611,7 +610,7 @@ orc_arm_emit_pkh (OrcCompiler *p, int op, OrcArmCond cond, static const char *pkh_insn_names[] = { "pkhbt", "pkhtb" }; if (sh > 0) { - snprintf (shifter, sizeof (shifter), ", %s #%d", + sprintf (shifter, sizeof (shifter), ", %s #%d", (op == 0 ? "LSL" : "ASR"), sh); } else { shifter[0] = '\0'; @@ -649,7 +648,7 @@ orc_arm_emit_sat (OrcCompiler *p, int op, OrcArmCond cond, static const int par_op[] = { 0, 0, 3, 3 }; if (sh > 0) { - snprintf (shifter, sizeof (shifter), ", %s #%d", + sprintf (shifter, sizeof (shifter), ", %s #%d", (asr&1 ? "ASR" : "LSL"), sh); } else { shifter[0] = '\0'; diff --git a/orc/orccodemem.c b/orc/orccodemem.c index 2a94be4..44034f6 100644 --- a/orc/orccodemem.c +++ b/orc/orccodemem.c @@ -5,7 +5,9 @@ #include <string.h> #include <stdlib.h> +#ifdef HAVE_UNISTD_H #include <unistd.h> +#endif #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> diff --git a/orc/orccpu-x86.c b/orc/orccpu-x86.c index eef2f51..829b2b8 100644 --- a/orc/orccpu-x86.c +++ b/orc/orccpu-x86.c @@ -34,14 +34,12 @@ #include <orc/orcprogram.h> #include <orc/orcutils.h> -#include <unistd.h> #include <fcntl.h> #include <stdlib.h> #include <string.h> #include <stdio.h> #include <setjmp.h> #include <signal.h> -#include <sys/time.h> #include <time.h> #if defined(__FreeBSD__) || defined(__APPLE__) @@ -165,6 +163,19 @@ orc_mmx_getflags_cpuinfo (char *cpuinfo) #endif #ifdef USE_I386_CPUID +#ifdef _MSC_VER +static void +get_cpuid (uint32_t op, uint32_t *a, uint32_t *b, uint32_t *c, uint32_t *d) +{ + int tmp[4]; + __cpuid(tmp, op); + *a = tmp[0]; + *b = tmp[1]; + *c = tmp[2]; + *d = tmp[3]; +} +#endif + #ifdef __i386__ static void get_cpuid (uint32_t op, uint32_t *a, uint32_t *b, uint32_t *c, uint32_t *d) diff --git a/orc/orcmmx.c b/orc/orcmmx.c index 1091fcb..2dc0388 100644 --- a/orc/orcmmx.c +++ b/orc/orcmmx.c @@ -5,7 +5,6 @@ #include <string.h> #include <stdlib.h> -#include <unistd.h> #include <sys/types.h> #include <orc/orcprogram.h> diff --git a/orc/orcopcodes.c b/orc/orcopcodes.c index 2211ee7..dd0ea8c 100644 --- a/orc/orcopcodes.c +++ b/orc/orcopcodes.c @@ -647,7 +647,7 @@ BINARY_FL(cmplef, (a <= b) ? (~0) : 0) static void convfl (OrcOpcodeExecutor *ex, void *user) { - ex->dest_values[0] = rintf(ORC_FLOAT_READ(&ex->src_values[0])); + ex->dest_values[0] = floor(0.5 + ORC_FLOAT_READ(&ex->src_values[0])); } static void diff --git a/orc/orcpowerpc.c b/orc/orcpowerpc.c index e84a97b..967b8d1 100644 --- a/orc/orcpowerpc.c +++ b/orc/orcpowerpc.c @@ -5,7 +5,6 @@ #include <string.h> #include <stdlib.h> -#include <unistd.h> #include <sys/types.h> #include <orc/orcpowerpc.h> diff --git a/orc/orcprogram-altivec.c b/orc/orcprogram-altivec.c index fd33457..73cc970 100644 --- a/orc/orcprogram-altivec.c +++ b/orc/orcprogram-altivec.c @@ -5,7 +5,6 @@ #include <string.h> #include <stdlib.h> -#include <unistd.h> #include <sys/types.h> #include <orc/orcpowerpc.h> diff --git a/orc/orcprogram-arm.c b/orc/orcprogram-arm.c index 4424421..9c94b3b 100644 --- a/orc/orcprogram-arm.c +++ b/orc/orcprogram-arm.c @@ -5,7 +5,6 @@ #include <string.h> #include <stdlib.h> -#include <unistd.h> #include <sys/types.h> #include <orc/orcprogram.h> diff --git a/orc/orcprogram-mmx.c b/orc/orcprogram-mmx.c index addb9cf..b8f0900 100644 --- a/orc/orcprogram-mmx.c +++ b/orc/orcprogram-mmx.c @@ -5,7 +5,6 @@ #include <string.h> #include <stdlib.h> -#include <unistd.h> #include <sys/types.h> #include <orc/orcprogram.h> diff --git a/orc/orcprogram-sse.c b/orc/orcprogram-sse.c index c6c0dc9..c1295f4 100644 --- a/orc/orcprogram-sse.c +++ b/orc/orcprogram-sse.c @@ -5,7 +5,6 @@ #include <string.h> #include <stdlib.h> -#include <unistd.h> #include <sys/types.h> #include <orc/orcprogram.h> diff --git a/orc/orcrules-altivec.c b/orc/orcrules-altivec.c index 49e385e..7c9ca69 100644 --- a/orc/orcrules-altivec.c +++ b/orc/orcrules-altivec.c @@ -5,7 +5,6 @@ #include <string.h> #include <stdlib.h> -#include <unistd.h> #include <sys/types.h> #include <orc/orcpowerpc.h> @@ -372,7 +371,7 @@ powerpc_rule_accl (OrcCompiler *p, void *user, OrcInstruction *insn) static void powerpc_rule_accsadubl (OrcCompiler *p, void *user, OrcInstruction *insn) { - int tmp1 = p->tmpreg;; + int tmp1 = p->tmpreg; int tmp2 = POWERPC_V31; int src1 = ORC_SRC_ARG (p, insn, 0); int src2 = ORC_SRC_ARG (p, insn, 1); diff --git a/orc/orcrules-arm.c b/orc/orcrules-arm.c index 4d3604d..3aff850 100644 --- a/orc/orcrules-arm.c +++ b/orc/orcrules-arm.c @@ -5,7 +5,6 @@ #include <string.h> #include <stdlib.h> -#include <unistd.h> #include <sys/types.h> #include <orc/orcdebug.h> diff --git a/orc/orcrules-mmx.c b/orc/orcrules-mmx.c index 2e9d5a1..f4dd74d 100644 --- a/orc/orcrules-mmx.c +++ b/orc/orcrules-mmx.c @@ -5,7 +5,6 @@ #include <string.h> #include <stdlib.h> -#include <unistd.h> #include <sys/types.h> #include <orc/orcprogram.h> diff --git a/orc/orcrules-sse.c b/orc/orcrules-sse.c index c7b0cd7..0a9363a 100644 --- a/orc/orcrules-sse.c +++ b/orc/orcrules-sse.c @@ -5,7 +5,6 @@ #include <string.h> #include <stdlib.h> -#include <unistd.h> #include <sys/types.h> #include <orc/orcprogram.h> diff --git a/orc/orcsse.c b/orc/orcsse.c index ed19339..4e83c20 100644 --- a/orc/orcsse.c +++ b/orc/orcsse.c @@ -5,7 +5,6 @@ #include <string.h> #include <stdlib.h> -#include <unistd.h> #include <sys/types.h> #include <orc/orcprogram.h> diff --git a/orc/orcutils.c b/orc/orcutils.c index 82d9aff..9f55c58 100644 --- a/orc/orcutils.c +++ b/orc/orcutils.c @@ -31,7 +31,6 @@ #include <orc/orcdebug.h> #include <orc/orcutils.h> -#include <unistd.h> #include <fcntl.h> #include <stdlib.h> #include <string.h> diff --git a/orc/orcx86.c b/orc/orcx86.c index 3f6cd8e..aba0313 100644 --- a/orc/orcx86.c +++ b/orc/orcx86.c @@ -5,7 +5,6 @@ #include <string.h> #include <stdlib.h> -#include <unistd.h> #include <sys/types.h> #include <orc/orcprogram.h> |