Use a 64-bit value to scale potentially-large numbers

This commit is contained in:
Chris Robinson 2009-12-24 15:41:45 -08:00
parent f6ca39403d
commit 7f0c6629b9
3 changed files with 16 additions and 12 deletions

View File

@ -37,17 +37,6 @@
#include "alu.h"
#include "bs2b.h"
#if defined(HAVE_STDINT_H)
#include <stdint.h>
typedef int64_t ALint64;
#elif defined(HAVE___INT64)
typedef __int64 ALint64;
#elif (SIZEOF_LONG == 8)
typedef long ALint64;
#elif (SIZEOF_LONG_LONG == 8)
typedef long long ALint64;
#endif
#define FRACTIONBITS 14
#define FRACTIONMASK ((1L<<FRACTIONBITS)-1)
#define MAX_PITCH 65536

View File

@ -581,7 +581,7 @@ static ALCboolean pulse_reset_playback(ALCdevice *device) //{{{
/* Server updated our playback rate, so modify the buffer attribs
* accordingly. */
data->attr.minreq = (data->attr.minreq/data->frame_size) *
data->attr.minreq = (ALuint64)(data->attr.minreq/data->frame_size) *
data->spec.rate / device->Frequency * data->frame_size;
data->attr.tlength = data->attr.minreq * device->NumUpdates;

View File

@ -13,6 +13,21 @@
#include "AL/alc.h"
#include "AL/alext.h"
#if defined(HAVE_STDINT_H)
#include <stdint.h>
typedef int64_t ALint64;
typedef uint64_t ALuint64;
#elif defined(HAVE___INT64)
typedef __int64 ALint64;
typedef unsigned __int64 ALuint64;
#elif (SIZEOF_LONG == 8)
typedef long ALint64;
typedef unsigned long ALuint64;
#elif (SIZEOF_LONG_LONG == 8)
typedef long long ALint64;
typedef unsigned long long ALuint64;
#endif
#ifdef _WIN32
#ifndef _WIN32_WINNT