aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornotaz2011-10-25 01:44:12 +0300
committernotaz2011-10-30 23:48:08 +0200
commit4e9dcd7fcb8c6710b343f81ff89d691a0fd1a5e6 (patch)
tree46d50a6ac8b521e30a44998cf531b04b93f18fde
parentcaeefe315aeb0c86e7c9135fac7d79d8e4e4ebd4 (diff)
downloadpcsx_rearmed-4e9dcd7fcb8c6710b343f81ff89d691a0fd1a5e6.tar.gz
pcsx_rearmed-4e9dcd7fcb8c6710b343f81ff89d691a0fd1a5e6.tar.bz2
pcsx_rearmed-4e9dcd7fcb8c6710b343f81ff89d691a0fd1a5e6.zip
drc: fix cycle multiplier code
rounding wrong way is enough to cause nasty timing problems
-rw-r--r--libpcsxcore/new_dynarec/new_dynarec.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/libpcsxcore/new_dynarec/new_dynarec.c b/libpcsxcore/new_dynarec/new_dynarec.c
index 5e6e66e..fb39cf0 100644
--- a/libpcsxcore/new_dynarec/new_dynarec.c
+++ b/libpcsxcore/new_dynarec/new_dynarec.c
@@ -44,9 +44,6 @@
#define MAXBLOCK 4096
#define MAX_OUTPUT_BLOCK_SIZE 262144
-int cycle_multiplier; // 100 for 1.0
-#define CLOCK_ADJUST(x) (((x) * cycle_multiplier + 50) / 100)
-
struct regstat
{
signed char regmap_entry[HOST_REGS];
@@ -279,6 +276,14 @@ int tracedebug=0;
//#define DEBUG_CYCLE_COUNT 1
+int cycle_multiplier; // 100 for 1.0
+
+static int CLOCK_ADJUST(int x)
+{
+ int s=(x>>31)|1;
+ return (x * cycle_multiplier + s * 50) / 100;
+}
+
static void tlb_hacks()
{
#ifndef DISABLE_TLB