Commit 86f3f83f authored by David Schleef's avatar David Schleef

Build fixes due to MSVC

parent 0acec171
#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
......
......@@ -8,7 +8,7 @@
#include <string.h>
#include <math.h>
static OrcStaticOpcode opcodes[];
extern OrcStaticOpcode opcodes[];
void orc_float_sse_register_rules (void);
......
......@@ -7,7 +7,7 @@
#include <stdlib.h>
#include <string.h>
static OrcStaticOpcode opcodes[];
extern OrcStaticOpcode opcodes[];
void orc_pixel_sse_register_rules (void);
......
......@@ -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);
......
......@@ -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;
......
......@@ -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';
......
......@@ -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>
......
......@@ -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)
......
......@@ -5,7 +5,6 @@
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <orc/orcprogram.h>
......
......@@ -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
......
......@@ -5,7 +5,6 @@
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <orc/orcpowerpc.h>
......
......@@ -5,7 +5,6 @@
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <orc/orcpowerpc.h>
......
......@@ -5,7 +5,6 @@
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <orc/orcprogram.h>
......
......@@ -5,7 +5,6 @@
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <orc/orcprogram.h>
......
......@@ -5,7 +5,6 @@
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <orc/orcprogram.h>
......
......@@ -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);
......
......@@ -5,7 +5,6 @@
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <orc/orcdebug.h>
......
......@@ -5,7 +5,6 @@
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <orc/orcprogram.h>
......
......@@ -5,7 +5,6 @@
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <orc/orcprogram.h>
......
......@@ -5,7 +5,6 @@
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <orc/orcprogram.h>
......
......@@ -31,7 +31,6 @@
#include <orc/orcdebug.h>
#include <orc/orcutils.h>
#include <unistd.h>
#include <fcntl.h>
#include <stdlib.h>
#include <string.h>
......
......@@ -5,7 +5,6 @@
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <orc/orcprogram.h>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment