Another round of -Wextra -Wdouble-promotion fixes. (nw)

This commit is contained in:
couriersud 2015-05-20 21:24:59 +02:00
parent a082abcd7d
commit f10abf48d7
34 changed files with 141 additions and 137 deletions

View File

@ -269,7 +269,7 @@ void s3virge_vga_device::s3_define_video_mode()
{
// Dot clock is set via SR12 and SR13
// DCLK calculation
freq = ((double)(s3.clk_pll_m+2) / (double)((s3.clk_pll_n+2)*(pow(2.0,s3.clk_pll_r)))) * 14.318f; // clock between XIN and XOUT
freq = ((double)(s3.clk_pll_m+2) / (double)((s3.clk_pll_n+2)*(pow(2.0,s3.clk_pll_r)))) * 14.318; // clock between XIN and XOUT
xtal = freq * 1000000;
//printf("DCLK set to %dHz M=%i N=%i R=%i\n",xtal,s3.clk_pll_m,s3.clk_pll_n,s3.clk_pll_r);
}

View File

@ -315,7 +315,7 @@ int trident_vga_device::calculate_clock()
m = tri.vid_clock & 0x007f;
n = (tri.vid_clock & 0x0f80) >> 7;
k = (tri.vid_clock & 0x1000) >> 12;
freq = ((double)(m+8) / (double)((n+2)*(pow(2.0,k)))) * 14.31818f; // there is a 14.31818MHz clock on the board
freq = ((double)(m+8) / (double)((n+2)*(pow(2.0,k)))) * 14.31818; // there is a 14.31818MHz clock on the board
return freq * 1000000;
}

View File

@ -1929,7 +1929,7 @@ int drcbe_c::execute(code_handle &entry)
break;
case MAKE_OPCODE_SHORT(OP_FRSQRT, 4, 0): // FSRSQRT dst,src1
FSPARAM0 = 1.0f / sqrt(FSPARAM1);
FSPARAM0 = 1.0f / sqrtf(FSPARAM1);
break;

View File

@ -3634,18 +3634,18 @@ void i386_device::sse_rcpps_r128_rm128() // Opcode 0f 53
{
UINT8 modrm = FETCH();
if( modrm >= 0xc0 ) {
XMM((modrm >> 3) & 0x7).f[0] = 1.0 / XMM(modrm & 0x7).f[0];
XMM((modrm >> 3) & 0x7).f[1] = 1.0 / XMM(modrm & 0x7).f[1];
XMM((modrm >> 3) & 0x7).f[2] = 1.0 / XMM(modrm & 0x7).f[2];
XMM((modrm >> 3) & 0x7).f[3] = 1.0 / XMM(modrm & 0x7).f[3];
XMM((modrm >> 3) & 0x7).f[0] = 1.0f / XMM(modrm & 0x7).f[0];
XMM((modrm >> 3) & 0x7).f[1] = 1.0f / XMM(modrm & 0x7).f[1];
XMM((modrm >> 3) & 0x7).f[2] = 1.0f / XMM(modrm & 0x7).f[2];
XMM((modrm >> 3) & 0x7).f[3] = 1.0f / XMM(modrm & 0x7).f[3];
} else {
XMM_REG src;
UINT32 ea = GetEA(modrm, 0);
READXMM(ea, src);
XMM((modrm >> 3) & 0x7).f[0] = 1.0 / src.f[0];
XMM((modrm >> 3) & 0x7).f[1] = 1.0 / src.f[1];
XMM((modrm >> 3) & 0x7).f[2] = 1.0 / src.f[2];
XMM((modrm >> 3) & 0x7).f[3] = 1.0 / src.f[3];
XMM((modrm >> 3) & 0x7).f[0] = 1.0f / src.f[0];
XMM((modrm >> 3) & 0x7).f[1] = 1.0f / src.f[1];
XMM((modrm >> 3) & 0x7).f[2] = 1.0f / src.f[2];
XMM((modrm >> 3) & 0x7).f[3] = 1.0f / src.f[3];
}
CYCLES(1); // TODO: correct cycle count
}
@ -3972,12 +3972,12 @@ void i386_device::sse_rcpss_r128_r128m32() // Opcode f3 0f 53
{
UINT8 modrm = FETCH();
if( modrm >= 0xc0 ) {
XMM((modrm >> 3) & 0x7).f[0] = 1.0 / XMM(modrm & 0x7).f[0];
XMM((modrm >> 3) & 0x7).f[0] = 1.0f / XMM(modrm & 0x7).f[0];
} else {
XMM_REG s;
UINT32 ea = GetEA(modrm, 0);
s.d[0]=READ32(ea);
XMM((modrm >> 3) & 0x7).f[0] = 1.0 / s.f[0];
XMM((modrm >> 3) & 0x7).f[0] = 1.0f / s.f[0];
}
CYCLES(1); // TODO: correct cycle count
}

View File

@ -3365,7 +3365,7 @@ void i860_cpu_device::insn_frcp (UINT32 insn)
{
float v = get_fregval_s (fsrc2);
float res;
if (v == 0.0)
if (v == 0.0f)
{
/* Generate source-exception trap if fsrc2 is 0. */
if (0 /* GET_FSR_FTE () */)
@ -3448,7 +3448,7 @@ void i860_cpu_device::insn_frsqr (UINT32 insn)
{
float v = get_fregval_s (fsrc2);
float res;
if (v == 0.0 || v < 0.0)
if (v == 0.0f || v < 0.0f)
{
/* Generate source-exception trap if fsrc2 is 0 or negative. */
if (0 /* GET_FSR_FTE () */)
@ -3463,7 +3463,8 @@ void i860_cpu_device::insn_frsqr (UINT32 insn)
{
SET_FSR_SE (0);
*((UINT32 *)&v) &= 0xffff8000;
res = (float)1.0/sqrt (v);
// FIXME: shouldn't this be 1.0f / sqrtf(v) ?
res = (float) (1.0/sqrt (v));
*((UINT32 *)&res) &= 0xffff8000;
if (res_prec)
set_fregval_d (fdest, (double)res);

View File

@ -2966,7 +2966,7 @@ inline void sh34_base_device::FSRRA(const UINT16 opcode)
if (FP_RFS(n) < 0)
return;
FP_RFS(n) = 1.0 / sqrtf(FP_RFS(n));
FP_RFS(n) = 1.0f / sqrtf(FP_RFS(n));
}
/* FSSCA FPUL,FRn PR=0 1111nnn011111101 */
@ -2974,9 +2974,9 @@ void sh34_base_device::FSSCA(const UINT16 opcode)
{
UINT32 n = Rn;
float angle;
float angle;
angle = (((float)(m_fpul & 0xFFFF)) / 65536.0) * 2.0 * M_PI;
angle = (((float)(m_fpul & 0xFFFF)) / 65536.0f) * 2.0f * (float) M_PI;
FP_RFS(n) = sinf(angle);
FP_RFS(n+1) = cosf(angle);
}

View File

@ -741,7 +741,7 @@ void adsp21062_device::compute_fclip(int rn, int rx, int ry)
{
SHARC_REG r_alu;
if (FREG(rx) < fabs(FREG(ry)))
if (FREG(rx) < fabsf(FREG(ry)))
{
r_alu.f = FREG(rx);
}
@ -749,11 +749,11 @@ void adsp21062_device::compute_fclip(int rn, int rx, int ry)
{
if (FREG(rx) >= 0.0f)
{
r_alu.f = fabs(FREG(ry));
r_alu.f = fabsf(FREG(ry));
}
else
{
r_alu.f = -fabs(FREG(ry));
r_alu.f = -fabsf(FREG(ry));
}
}

View File

@ -1428,7 +1428,7 @@ void tms32082_mp_device::execute_reg_long_imm()
{
float s1 = u2f(has_imm ? imm32 : m_reg[src1]);
double s2 = u2d(m_fpair[rs >> 1]);
UINT64 res = d2u((double)(s1 + s2));
UINT64 res = d2u((double) s1 + s2);
m_fpair[rd >> 1] = res;
break;
}
@ -1436,7 +1436,7 @@ void tms32082_mp_device::execute_reg_long_imm()
{
double s1 = u2d(m_fpair[src1 >> 1]);
float s2 = u2f(m_reg[rs]);
UINT64 res = d2u((double)(s1 + s2));
UINT64 res = d2u(s1 + (double) s2);
m_fpair[rd >> 1] = res;
break;
}
@ -1486,7 +1486,7 @@ void tms32082_mp_device::execute_reg_long_imm()
{
float s1 = u2f(has_imm ? imm32 : m_reg[src1]);
double s2 = u2d(m_fpair[rs >> 1]);
UINT64 res = d2u((double)(s1 - s2));
UINT64 res = d2u((double) s1 - s2);
m_fpair[rd >> 1] = res;
break;
}
@ -1494,7 +1494,7 @@ void tms32082_mp_device::execute_reg_long_imm()
{
double s1 = u2d(m_fpair[src1 >> 1]);
float s2 = u2f(m_reg[rs]);
UINT64 res = d2u((double)(s1 - s2));
UINT64 res = d2u(s1 - (double) s2);
m_fpair[rd >> 1] = res;
break;
}
@ -1544,7 +1544,7 @@ void tms32082_mp_device::execute_reg_long_imm()
{
float s1 = u2f(has_imm ? imm32 : m_reg[src1]);
double s2 = u2d(m_fpair[rs >> 1]);
UINT64 res = d2u((double)(s1 * s2));
UINT64 res = d2u((double)s1 * s2);
m_fpair[rd >> 1] = res;
break;
}
@ -1552,7 +1552,7 @@ void tms32082_mp_device::execute_reg_long_imm()
{
double s1 = u2d(m_fpair[src1 >> 1]);
float s2 = u2f(m_reg[rs]);
UINT64 res = d2u((double)(s1 * s2));
UINT64 res = d2u(s1 * (double) s2);
m_fpair[rd >> 1] = res;
break;
}
@ -1560,7 +1560,7 @@ void tms32082_mp_device::execute_reg_long_imm()
{
double s1 = u2d(m_fpair[src1 >> 1]);
double s2 = u2d(m_fpair[rs >> 1]);
UINT64 res = d2u((double)(s1 * s2));
UINT64 res = d2u(s1 * s2);
m_fpair[rd >> 1] = res;
break;
}

View File

@ -924,8 +924,8 @@ void v810_device::opADDF(UINT32 op)
float val2=u2f(GETREG(GET2));
SET_OV(0);
val2+=val1;
SET_Z((val2==0.0)?1:0);
SET_S((val2<0.0)?1:0);
SET_Z((val2==0.0f)?1:0);
SET_S((val2<0.0f)?1:0);
SETREG(GET2,f2u(val2));
}
@ -936,8 +936,8 @@ void v810_device::opSUBF(UINT32 op)
SET_OV(0);
SET_CY((val2<val1)?1:0);
val2-=val1;
SET_Z((val2==0.0)?1:0);
SET_S((val2<0.0)?1:0);
SET_Z((val2==0.0f)?1:0);
SET_S((val2<0.0f)?1:0);
SETREG(GET2,f2u(val2));
}
@ -948,8 +948,8 @@ void v810_device::opMULF(UINT32 op)
float val2=u2f(GETREG(GET2));
SET_OV(0);
val2*=val1;
SET_Z((val2==0.0)?1:0);
SET_S((val2<0.0)?1:0);
SET_Z((val2==0.0f)?1:0);
SET_S((val2<0.0f)?1:0);
SETREG(GET2,f2u(val2));
}
@ -963,8 +963,8 @@ void v810_device::opDIVF(UINT32 op)
val2/=val1;
else
printf("DIVF divide by zero?\n");
SET_Z((val2==0.0)?1:0);
SET_S((val2<0.0)?1:0);
SET_Z((val2==0.0f)?1:0);
SET_S((val2<0.0f)?1:0);
SETREG(GET2,f2u(val2));
}
@ -972,8 +972,8 @@ void v810_device::opTRNC(UINT32 op)
{
float val1=u2f(GETREG(GET1));
SET_OV(0);
SET_Z((val1==0.0)?1:0);
SET_S((val1<0.0)?1:0);
SET_Z((val1==0.0f)?1:0);
SET_S((val1<0.0f)?1:0);
SETREG(GET2,(INT32)val1);
}
@ -984,16 +984,16 @@ void v810_device::opCMPF(UINT32 op)
SET_OV(0);
SET_CY((val2<val1)?1:0);
val2-=val1;
SET_Z((val2==0.0)?1:0);
SET_S((val2<0.0)?1:0);
SET_Z((val2==0.0f)?1:0);
SET_S((val2<0.0f)?1:0);
}
void v810_device::opCVTS(UINT32 op)
{
float val1=u2f(GETREG(GET1));
SET_OV(0);
SET_Z((val1==0.0)?1:0);
SET_S((val1<0.0)?1:0);
SET_Z((val1==0.0f)?1:0);
SET_S((val1<0.0f)?1:0);
SETREG(GET2,(INT32)val1);
}
@ -1002,8 +1002,8 @@ void v810_device::opCVTW(UINT32 op)
//TODO: CY
float val1=(INT32)GETREG(GET1);
SET_OV(0);
SET_Z((val1==0.0)?1:0);
SET_S((val1<0.0)?1:0);
SET_Z((val1==0.0f)?1:0);
SET_S((val1<0.0f)?1:0);
SETREG(GET2,f2u(val1));
}
@ -1013,8 +1013,8 @@ void v810_device::opMPYHW(UINT32 op)
int val2=(GETREG(GET2) & 0xffff);
SET_OV(0);
val2*=val1;
SET_Z((val2==0.0)?1:0);
SET_S((val2<0.0)?1:0);
SET_Z((val2==0.0f)?1:0);
SET_S((val2<0.0f)?1:0);
SETREG(GET2,val2);
}
@ -1023,8 +1023,8 @@ void v810_device::opXB(UINT32 op)
int val=GETREG(GET2);
SET_OV(0);
val = (val & 0xffff0000) | ((val & 0xff) << 8) | ((val & 0xff00) >> 8);
SET_Z((val==0.0)?1:0);
SET_S((val<0.0)?1:0);
SET_Z((val==0.0f)?1:0);
SET_S((val<0.0f)?1:0);
SETREG(GET2,val);
}
@ -1034,8 +1034,8 @@ void v810_device::opXH(UINT32 op)
int val=GETREG(GET2);
SET_OV(0);
val = ((val & 0xffff0000)>>16) | ((val & 0xffff)<<16);
SET_Z((val==0.0)?1:0);
SET_S((val<0.0)?1:0);
SET_Z((val==0.0f)?1:0);
SET_S((val<0.0f)?1:0);
SETREG(GET2,val);
}

View File

@ -1995,7 +1995,7 @@ void ioport_field::frame_update(ioport_value &result, bool mouse_down)
void ioport_field::crosshair_position(float &x, float &y, bool &gotx, bool &goty)
{
float value = m_live->analog->crosshair_read();
double value = m_live->analog->crosshair_read();
// apply the scale and offset
if (m_crosshair_scale < 0)

View File

@ -642,10 +642,10 @@ int lua_engine::lua_screen::l_draw_box(lua_State *L)
int sc_width = sc->visible_area().width();
int sc_height = sc->visible_area().height();
float x1, y1, x2, y2;
x1 = MIN(MAX(0, lua_tonumber(L, 2)), sc_width-1) / static_cast<float>(sc_width);
y1 = MIN(MAX(0, lua_tonumber(L, 3)), sc_height-1) / static_cast<float>(sc_height);
x2 = MIN(MAX(0, lua_tonumber(L, 4)), sc_width-1) / static_cast<float>(sc_width);
y2 = MIN(MAX(0, lua_tonumber(L, 5)), sc_height-1) / static_cast<float>(sc_height);
x1 = MIN(MAX(0, (float) lua_tonumber(L, 2)), sc_width-1) / static_cast<float>(sc_width);
y1 = MIN(MAX(0, (float) lua_tonumber(L, 3)), sc_height-1) / static_cast<float>(sc_height);
x2 = MIN(MAX(0, (float) lua_tonumber(L, 4)), sc_width-1) / static_cast<float>(sc_width);
y2 = MIN(MAX(0, (float) lua_tonumber(L, 5)), sc_height-1) / static_cast<float>(sc_height);
UINT32 bgcolor = lua_tounsigned(L, 6);
UINT32 fgcolor = lua_tounsigned(L, 7);
@ -680,10 +680,10 @@ int lua_engine::lua_screen::l_draw_line(lua_State *L)
int sc_width = sc->visible_area().width();
int sc_height = sc->visible_area().height();
float x1, y1, x2, y2;
x1 = MIN(MAX(0, lua_tonumber(L, 2)), sc_width-1) / static_cast<float>(sc_width);
y1 = MIN(MAX(0, lua_tonumber(L, 3)), sc_height-1) / static_cast<float>(sc_height);
x2 = MIN(MAX(0, lua_tonumber(L, 4)), sc_width-1) / static_cast<float>(sc_width);
y2 = MIN(MAX(0, lua_tonumber(L, 5)), sc_height-1) / static_cast<float>(sc_height);
x1 = MIN(MAX(0, (float) lua_tonumber(L, 2)), sc_width-1) / static_cast<float>(sc_width);
y1 = MIN(MAX(0, (float) lua_tonumber(L, 3)), sc_height-1) / static_cast<float>(sc_height);
x2 = MIN(MAX(0, (float) lua_tonumber(L, 4)), sc_width-1) / static_cast<float>(sc_width);
y2 = MIN(MAX(0, (float) lua_tonumber(L, 5)), sc_height-1) / static_cast<float>(sc_height);
UINT32 color = lua_tounsigned(L, 6);
// draw the line
@ -712,8 +712,8 @@ int lua_engine::lua_screen::l_draw_text(lua_State *L)
// retrieve all parameters
int sc_width = sc->visible_area().width();
int sc_height = sc->visible_area().height();
float x = MIN(MAX(0, lua_tonumber(L, 2)), sc_width-1) / static_cast<float>(sc_width);
float y = MIN(MAX(0, lua_tonumber(L, 3)), sc_height-1) / static_cast<float>(sc_height);
float x = MIN(MAX(0, (float) lua_tonumber(L, 2)), sc_width-1) / static_cast<float>(sc_width);
float y = MIN(MAX(0, (float) lua_tonumber(L, 3)), sc_height-1) / static_cast<float>(sc_height);
const char *msg = luaL_checkstring(L,4);
rgb_t textcolor = UI_TEXT_COLOR;
if (!lua_isnone(L, 5)) {

View File

@ -309,7 +309,7 @@ WRITE_LINE_MEMBER( upd1990a_device::stb_w )
m_shift_reg[i] = m_time_counter[i];
// data out pulse: uPD4990A: 1Hz, uPD1990A: 512Hz in testmode, 0.5Hz in normal mode
float div;
double div;
if (m_variant == TYPE_4990A)
div = 32768.0;
else if (m_testmode)
@ -331,7 +331,7 @@ WRITE_LINE_MEMBER( upd1990a_device::stb_w )
case MODE_TP_4096HZ:
{
// set timer pulse
const float div[4] = { 512.0, 128.0, 16.0, 8.0 };
const double div[4] = { 512.0, 128.0, 16.0, 8.0 };
m_timer_tp->adjust(attotime::zero, 0, attotime::from_hz((clock() / div[m_c - MODE_TP_64HZ]) * 2.0));
break;
@ -344,7 +344,7 @@ WRITE_LINE_MEMBER( upd1990a_device::stb_w )
{
// set timer pulse
attotime one_second = attotime::from_hz(clock() / 32768.0);
const float mul[4] = { 1.0, 10.0, 30.0, 60.0 };
const double mul[4] = { 1.0, 10.0, 30.0, 60.0 };
m_timer_tp->adjust(attotime::zero, 0, one_second * mul[m_c - MODE_TP_1S_INT] / 2.0);
break;

View File

@ -1890,7 +1890,7 @@ bool render_target::map_point_internal(INT32 target_x, INT32 target_y, render_co
if (container != NULL && container == &m_manager.ui_container())
{
// this hit test went against the UI container
if (target_fx >= 0.0 && target_fx < 1.0 && target_fy >= 0.0 && target_fy < 1.0)
if (target_fx >= 0.0f && target_fx < 1.0f && target_fy >= 0.0f && target_fy < 1.0f)
{
// this point was successfully mapped
mapped_x = (float)target_x / m_width;

View File

@ -327,7 +327,8 @@ void parse_bounds(running_machine &machine, xml_data_node *boundsnode, render_bo
// check for errors
if (bounds.x0 > bounds.x1 || bounds.y0 > bounds.y1)
throw emu_fatalerror("Illegal bounds value in XML: (%f-%f)-(%f-%f)", bounds.x0, bounds.x1, bounds.y0, bounds.y1);
throw emu_fatalerror("Illegal bounds value in XML: (%f-%f)-(%f-%f)",
(double) bounds.x0, (double) bounds.x1, (double) bounds.y0, (double) bounds.y1);
}
@ -351,9 +352,10 @@ void parse_color(running_machine &machine, xml_data_node *colornode, render_colo
color.a = xml_get_attribute_float_with_subst(machine, *colornode, "alpha", 1.0);
// check for errors
if (color.r < 0.0 || color.r > 1.0 || color.g < 0.0 || color.g > 1.0 ||
color.b < 0.0 || color.b > 1.0 || color.a < 0.0 || color.a > 1.0)
throw emu_fatalerror("Illegal ARGB color value in XML: %f,%f,%f,%f", color.r, color.g, color.b, color.a);
if (color.r < 0.0f || color.r > 1.0f || color.g < 0.0f || color.g > 1.0f ||
color.b < 0.0f || color.b > 1.0f || color.a < 0.0f || color.a > 1.0f)
throw emu_fatalerror("Illegal ARGB color value in XML: %f,%f,%f,%f",
(double) color.r, (double) color.g, (double) color.b, (double) color.a);
}
@ -807,10 +809,10 @@ void layout_element::component::draw(running_machine &machine, bitmap_argb32 &de
void layout_element::component::draw_rect(bitmap_argb32 &dest, const rectangle &bounds)
{
// compute premultiplied colors
UINT32 r = m_color.r * m_color.a * 255.0;
UINT32 g = m_color.g * m_color.a * 255.0;
UINT32 b = m_color.b * m_color.a * 255.0;
UINT32 inva = (1.0f - m_color.a) * 255.0;
UINT32 r = m_color.r * m_color.a * 255.0f;
UINT32 g = m_color.g * m_color.a * 255.0f;
UINT32 b = m_color.b * m_color.a * 255.0f;
UINT32 inva = (1.0f - m_color.a) * 255.0f;
// iterate over X and Y
for (UINT32 y = bounds.min_y; y <= bounds.max_y; y++)
@ -845,10 +847,10 @@ void layout_element::component::draw_rect(bitmap_argb32 &dest, const rectangle &
void layout_element::component::draw_disk(bitmap_argb32 &dest, const rectangle &bounds)
{
// compute premultiplied colors
UINT32 r = m_color.r * m_color.a * 255.0;
UINT32 g = m_color.g * m_color.a * 255.0;
UINT32 b = m_color.b * m_color.a * 255.0;
UINT32 inva = (1.0f - m_color.a) * 255.0;
UINT32 r = m_color.r * m_color.a * 255.0f;
UINT32 g = m_color.g * m_color.a * 255.0f;
UINT32 b = m_color.b * m_color.a * 255.0f;
UINT32 inva = (1.0f - m_color.a) * 255.0f;
// find the center
float xcenter = float(bounds.xcenter());
@ -861,7 +863,7 @@ void layout_element::component::draw_disk(bitmap_argb32 &dest, const rectangle &
for (UINT32 y = bounds.min_y; y <= bounds.max_y; y++)
{
float ycoord = ycenter - ((float)y + 0.5f);
float xval = xradius * sqrt(1.0f - (ycoord * ycoord) * ooyradius2);
float xval = xradius * sqrtf(1.0f - (ycoord * ycoord) * ooyradius2);
// compute left/right coordinates
INT32 left = (INT32)(xcenter - xval + 0.5f);
@ -897,10 +899,10 @@ void layout_element::component::draw_disk(bitmap_argb32 &dest, const rectangle &
void layout_element::component::draw_text(running_machine &machine, bitmap_argb32 &dest, const rectangle &bounds)
{
// compute premultiplied colors
UINT32 r = m_color.r * 255.0;
UINT32 g = m_color.g * 255.0;
UINT32 b = m_color.b * 255.0;
UINT32 a = m_color.a * 255.0;
UINT32 r = m_color.r * 255.0f;
UINT32 g = m_color.g * 255.0f;
UINT32 b = m_color.b * 255.0f;
UINT32 a = m_color.a * 255.0f;
// get the width of the string
render_font *font = machine.render().font_alloc("default");
@ -1006,10 +1008,10 @@ void layout_element::component::draw_reel(running_machine &machine, bitmap_argb3
int use_state = (state + m_stateoffset) % max_state_used;
// compute premultiplied colors
UINT32 r = m_color.r * 255.0;
UINT32 g = m_color.g * 255.0;
UINT32 b = m_color.b * 255.0;
UINT32 a = m_color.a * 255.0;
UINT32 r = m_color.r * 255.0f;
UINT32 g = m_color.g * 255.0f;
UINT32 b = m_color.b * 255.0f;
UINT32 a = m_color.a * 255.0f;
// get the width of the string
render_font *font = machine.render().font_alloc("default");
@ -1159,10 +1161,10 @@ void layout_element::component::draw_beltreel(running_machine &machine, bitmap_a
int use_state = (state + m_stateoffset) % max_state_used;
// compute premultiplied colors
UINT32 r = m_color.r * 255.0;
UINT32 g = m_color.g * 255.0;
UINT32 b = m_color.b * 255.0;
UINT32 a = m_color.a * 255.0;
UINT32 r = m_color.r * 255.0f;
UINT32 g = m_color.g * 255.0f;
UINT32 b = m_color.b * 255.0f;
UINT32 a = m_color.a * 255.0f;
// get the width of the string
render_font *font = machine.render().font_alloc("default");

View File

@ -225,7 +225,8 @@ int sound_stream::input_source_outputnum(int inputnum) const
void sound_stream::set_input(int index, sound_stream *input_stream, int output_index, float gain)
{
VPRINTF(("stream_set_input(%p, '%s', %d, %p, %d, %f)\n", this, m_device.tag(), index, input_stream, output_index, gain));
VPRINTF(("stream_set_input(%p, '%s', %d, %p, %d, %f)\n", this, m_device.tag(),
index, input_stream, output_index, (double) gain));
// make sure it's a valid input
if (index >= m_input.size())
@ -983,9 +984,9 @@ void sound_manager::config_load(int config_type, xml_data_node *parentnode)
mixer_input info;
if (indexed_mixer_input(xml_get_attribute_int(channelnode, "index", -1), info))
{
float defvol = xml_get_attribute_float(channelnode, "defvol", 1.0);
float newvol = xml_get_attribute_float(channelnode, "newvol", -1000.0);
if (newvol != -1000.0)
float defvol = xml_get_attribute_float(channelnode, "defvol", 1.0f);
float newvol = xml_get_attribute_float(channelnode, "newvol", -1000.0f);
if (newvol != -1000.0f)
info.stream->set_user_gain(info.inputnum, newvol / defvol);
}
}

View File

@ -24,10 +24,10 @@
#define LFIX(v) ((unsigned int) ((float) (1<<LFO_SHIFT)*(v)))
//Convert DB to multiply amplitude
#define DB(v) LFIX(pow(10.0,v/20.0))
#define DB(v) LFIX(powf(10.0f,v/20.0f))
//Convert cents to step increment
#define CENTS(v) LFIX(pow(2.0,v/1200.0))
#define CENTS(v) LFIX(powf(2.0f,v/1200.0f))
/*
AICA features 64 programmable slots

View File

@ -648,7 +648,7 @@ void discrete_device::display_profiling(void)
discrete_step_interface *step;
if ((*node)->interface(step))
if (step->run_time > tresh)
printf("%3d: %20s %8.2f %10.2f\n", (*node)->index(), (*node)->module_name(), (float) step->run_time / (float) total * 100.0, ((float) step->run_time) / (float) m_total_samples);
printf("%3d: %20s %8.2f %10.2f\n", (*node)->index(), (*node)->module_name(), (double) step->run_time / (double) total * 100.0, ((double) step->run_time) / (double) m_total_samples);
}
/* Task information */

View File

@ -2548,7 +2548,7 @@ static void FM_ADPCMAWrite(YM2610 *F2610,int r,int v)
if( (v>>c)&1 )
{
/**** start adpcm ****/
adpcm[c].step = (UINT32)((float)(1<<ADPCM_SHIFT)*((float)F2610->OPN.ST.freqbase)/3.0);
adpcm[c].step = (UINT32)((float)(1<<ADPCM_SHIFT)*((float)F2610->OPN.ST.freqbase)/3.0f);
adpcm[c].now_addr = adpcm[c].start<<1;
adpcm[c].now_step = 0;
adpcm[c].adpcm_acc = 0;
@ -3043,9 +3043,9 @@ void ym2608_reset_chip(void *chip)
for( i = 0; i < 6; i++ )
{
if (i<=3) /* channels 0,1,2,3 */
F2608->adpcm[i].step = (UINT32)((float)(1<<ADPCM_SHIFT)*((float)F2608->OPN.ST.freqbase)/3.0);
F2608->adpcm[i].step = (UINT32)((float)(1<<ADPCM_SHIFT)*((float)F2608->OPN.ST.freqbase)/3.0f);
else /* channels 4 and 5 work with slower clock */
F2608->adpcm[i].step = (UINT32)((float)(1<<ADPCM_SHIFT)*((float)F2608->OPN.ST.freqbase)/6.0);
F2608->adpcm[i].step = (UINT32)((float)(1<<ADPCM_SHIFT)*((float)F2608->OPN.ST.freqbase)/6.0f);
F2608->adpcm[i].start = YM2608_ADPCM_ROM_addr[i*2];
F2608->adpcm[i].end = YM2608_ADPCM_ROM_addr[i*2+1];
@ -3721,7 +3721,7 @@ void ym2610_reset_chip(void *chip)
/**** ADPCM work initial ****/
for( i = 0; i < 6 ; i++ )
{
F2610->adpcm[i].step = (UINT32)((float)(1<<ADPCM_SHIFT)*((float)F2610->OPN.ST.freqbase)/3.0);
F2610->adpcm[i].step = (UINT32)((float)(1<<ADPCM_SHIFT)*((float)F2610->OPN.ST.freqbase)/3.0f);
F2610->adpcm[i].now_addr = 0;
F2610->adpcm[i].now_step = 0;
F2610->adpcm[i].start = 0;

View File

@ -158,7 +158,7 @@ void multipcm_device::EG_Calc(SLOT *slot)
#define LFIX(v) ((unsigned int) ((float) (1<<LFO_SHIFT)*(v)))
//Convert DB to multiply amplitude
#define DB(v) LFIX(pow(10.0,v/20.0))
#define DB(v) LFIX(powf(10.0f,v/20.0f))
//Convert cents to step increment
#define CENTS(v) LFIX(powf(2.0f,v/1200.0f))

View File

@ -590,7 +590,7 @@ void scsp_device::init()
t=ARTimes[i]; //In ms
if(t!=0.0)
{
step=(1023*1000.0)/( 44100.0f*t);
step=(1023*1000.0)/( 44100.0*t);
scale=(double) (1<<EG_SHIFT);
m_ARTABLE[i]=(int) (step*scale);
}
@ -1432,10 +1432,10 @@ READ16_MEMBER( scsp_device::midi_out_r )
#define LFIX(v) ((unsigned int) ((float) (1<<LFO_SHIFT)*(v)))
//Convert DB to multiply amplitude
#define DB(v) LFIX(pow(10.0,v/20.0))
#define DB(v) LFIX(powf(10.0f,v/20.0f))
//Convert cents to step increment
#define CENTS(v) LFIX(pow(2.0,v/1200.0))
#define CENTS(v) LFIX(powf(2.0f,v/1200.0f))
static const float LFOFreq[32]=

View File

@ -344,7 +344,7 @@ INLINE void waveCalcFilter(sidOperator* pVoice)
else if (pVoice->sid->filter.Type == 0x40)
{
float tmp, tmp2;
pVoice->filtLow += ( pVoice->filtRef * pVoice->sid->filter.Dy * 0.1 );
pVoice->filtLow += ( pVoice->filtRef * pVoice->sid->filter.Dy * 0.1f );
tmp = (float)pVoice->filtIO - pVoice->filtLow;
tmp -= pVoice->filtRef * pVoice->sid->filter.ResDy;
pVoice->filtRef += ( tmp * (pVoice->sid->filter.Dy) );

View File

@ -2333,9 +2333,9 @@ void spu_device::set_xa_format(const float _freq, const int channels)
// Adjust frequency to compensate for slightly slower/faster frame rate
// float freq=44100.0; //(_freq*get_adjusted_frame_rate())/ps1hw.rcnt->get_vertical_refresh();
xa_freq=(unsigned int)((_freq/44100.0)*4096.0f);
xa_freq=(unsigned int)((_freq/44100.0f)*4096.0f);
xa_channels=channels;
xa_spf=(unsigned int)(_freq/60.0)*channels;
xa_spf=(unsigned int)(_freq/60.0f)*channels;
}
//

View File

@ -25,7 +25,7 @@
/* DIP switch rendering parameters */
#define DIP_SWITCH_HEIGHT 0.05f
#define DIP_SWITCH_SPACING 0.01
#define DIP_SWITCH_SPACING 0.01f
#define SINGLE_TOGGLE_SWITCH_FIELD_WIDTH 0.025f
#define SINGLE_TOGGLE_SWITCH_WIDTH 0.020f
/* make the switch 80% of the width space and 1/2 of the switch height */

View File

@ -695,7 +695,7 @@ void ui_menu::draw_text_box()
JUSTIFY_LEFT, WRAP_WORD, DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &target_width, &target_height);
target_height += 2.0f * line_height;
if (target_height > 1.0f - 2.0f * UI_BOX_TB_BORDER)
target_height = floor((1.0f - 2.0f * UI_BOX_TB_BORDER) / line_height) * line_height;
target_height = floorf((1.0f - 2.0f * UI_BOX_TB_BORDER) / line_height) * line_height;
// maximum against "return to prior menu" text
prior_width = machine().ui().get_string_width(backtext) + 2.0f * gutter_width;

View File

@ -2044,8 +2044,8 @@ static INT32 slider_overclock(running_machine &machine, void *arg, std::string *
if (newval != SLIDER_NOCHANGE)
cpu->set_clock_scale((float)newval * 0.001f);
if (str != NULL)
strprintf(*str,"%3.0f%%", floor(cpu->clock_scale() * 100.0f + 0.5f));
return floorf(cpu->clock_scale() * 1000.0f + 0.5f);
strprintf(*str,"%3.0f%%", floor(cpu->clock_scale() * 100.0 + 0.5));
return floor(cpu->clock_scale() * 1000.0 + 0.5);
}
@ -2069,7 +2069,7 @@ static INT32 slider_refresh(running_machine &machine, void *arg, std::string *st
if (str != NULL)
strprintf(*str,"%.3ffps", ATTOSECONDS_TO_HZ(machine.first_screen()->frame_period().attoseconds));
refresh = ATTOSECONDS_TO_HZ(machine.first_screen()->frame_period().attoseconds);
return floorf((refresh - defrefresh) * 1000.0f + 0.5f);
return floor((refresh - defrefresh) * 1000.0 + 0.5);
}

View File

@ -482,7 +482,7 @@ void validity_checker::validate_inlines()
if (resultu32 != expectedu32)
osd_printf_error("Error testing divu_32x32_shift (%08X << 3) / %08X = %08X (expected %08X)\n", (UINT32)testu64a, testu32a, resultu32, expectedu32);
if (fabs(recip_approx(100.0) - 0.01) > 0.0001)
if (fabsf(recip_approx(100.0f) - 0.01f) > 0.0001f)
osd_printf_error("Error testing recip_approx\n");
testi32a = (testi32a & 0x0000ffff) | 0x400000;

View File

@ -636,7 +636,7 @@ inline bool video_manager::effective_throttle() const
inline int video_manager::original_speed_setting() const
{
return machine().options().speed() * 1000.0 + 0.5;
return machine().options().speed() * 1000.0f + 0.5f;
}
@ -901,7 +901,7 @@ void video_manager::update_frameskip()
if (effective_throttle() && effective_autoframeskip() && m_frameskip_counter == 0)
{
// calibrate the "adjusted speed" based on the target
double adjusted_speed_percent = m_speed_percent / m_throttle_rate;
double adjusted_speed_percent = m_speed_percent / (double) m_throttle_rate;
// if we're too fast, attempt to increase the frameskip
double speed = m_speed * 0.001;
@ -953,7 +953,7 @@ void video_manager::update_refresh_speed()
// only do this if the refreshspeed option is used
if (machine().options().refresh_speed())
{
float minrefresh = machine().render().max_update_rate();
double minrefresh = machine().render().max_update_rate();
if (minrefresh != 0)
{
// find the screen with the shortest frame period (max refresh rate)
@ -970,7 +970,7 @@ void video_manager::update_refresh_speed()
// compute a target speed as an integral percentage
// note that we lop 0.25Hz off of the minrefresh when doing the computation to allow for
// the fact that most refresh rates are not accurate to 10 digits...
UINT32 target_speed = floor((minrefresh - 0.25f) * 1000.0 / ATTOSECONDS_TO_HZ(min_frame_period));
UINT32 target_speed = floor((minrefresh - 0.25) * 1000.0 / ATTOSECONDS_TO_HZ(min_frame_period));
UINT32 original_speed = original_speed_setting();
target_speed = MIN(target_speed, original_speed);

View File

@ -2672,7 +2672,7 @@ void s3_vga_device::s3_define_video_mode()
if((vga.miscellaneous_output & 0xc) == 0x0c)
{
// DCLK calculation
freq = ((double)(s3.clk_pll_m+2) / (double)((s3.clk_pll_n+2)*(pow(2.0,s3.clk_pll_r)))) * 14.318f; // clock between XIN and XOUT
freq = ((double)(s3.clk_pll_m+2) / (double)((s3.clk_pll_n+2)*(pow(2.0,s3.clk_pll_r)))) * 14.318; // clock between XIN and XOUT
xtal = freq * 1000000;
}

View File

@ -607,7 +607,7 @@ UINT32 poly_render_triangle(legacy_poly_manager *poly, void *dest, const rectang
float a22 = v1->x*v2->y - v2->x*v1->y;
float det = a02 + a12 + a22;
if(fabsf(det) < 0.001) {
if(fabsf(det) < 0.001f) {
for (int paramnum = 0; paramnum < paramcount; paramnum++)
{
poly_param *params = &polygon->param[paramnum];

View File

@ -2918,7 +2918,7 @@ default_case:
if (regnum < fvertexAx || regnum > fdWdY)
logerror("VOODOO.%d.REG:%s(%d) write = %08X\n", v->index, (regnum < 0x384/4) ? v->regnames[regnum] : "oob", chips, origdata);
else
logerror("VOODOO.%d.REG:%s(%d) write = %f\n", v->index, (regnum < 0x384/4) ? v->regnames[regnum] : "oob", chips, u2f(origdata));
logerror("VOODOO.%d.REG:%s(%d) write = %f\n", v->index, (regnum < 0x384/4) ? v->regnames[regnum] : "oob", chips, (double) u2f(origdata));
}
return cycles;
@ -5436,12 +5436,12 @@ static INT32 setup_and_draw_triangle(voodoo_state *v)
float divisor, tdiv;
/* grab the X/Ys at least */
v->fbi.ax = (INT16)(v->fbi.svert[0].x * 16.0);
v->fbi.ay = (INT16)(v->fbi.svert[0].y * 16.0);
v->fbi.bx = (INT16)(v->fbi.svert[1].x * 16.0);
v->fbi.by = (INT16)(v->fbi.svert[1].y * 16.0);
v->fbi.cx = (INT16)(v->fbi.svert[2].x * 16.0);
v->fbi.cy = (INT16)(v->fbi.svert[2].y * 16.0);
v->fbi.ax = (INT16)(v->fbi.svert[0].x * 16.0f);
v->fbi.ay = (INT16)(v->fbi.svert[0].y * 16.0f);
v->fbi.bx = (INT16)(v->fbi.svert[1].x * 16.0f);
v->fbi.by = (INT16)(v->fbi.svert[1].y * 16.0f);
v->fbi.cx = (INT16)(v->fbi.svert[2].x * 16.0f);
v->fbi.cy = (INT16)(v->fbi.svert[2].y * 16.0f);
/* compute the divisor */
divisor = 1.0f / ((v->fbi.svert[0].x - v->fbi.svert[1].x) * (v->fbi.svert[0].y - v->fbi.svert[2].y) -
@ -5486,7 +5486,7 @@ static INT32 setup_and_draw_triangle(voodoo_state *v)
/* set up alpha */
if (v->reg[sSetupMode].u & (1 << 1))
{
v->fbi.starta = (INT32)(v->fbi.svert[0].a * 4096.0);
v->fbi.starta = (INT32)(v->fbi.svert[0].a * 4096.0f);
v->fbi.dadx = (INT32)(((v->fbi.svert[0].a - v->fbi.svert[1].a) * dx1 - (v->fbi.svert[0].a - v->fbi.svert[2].a) * dx2) * tdiv);
v->fbi.dady = (INT32)(((v->fbi.svert[0].a - v->fbi.svert[2].a) * dy1 - (v->fbi.svert[0].a - v->fbi.svert[1].a) * dy2) * tdiv);
}
@ -5494,7 +5494,7 @@ static INT32 setup_and_draw_triangle(voodoo_state *v)
/* set up Z */
if (v->reg[sSetupMode].u & (1 << 2))
{
v->fbi.startz = (INT32)(v->fbi.svert[0].z * 4096.0);
v->fbi.startz = (INT32)(v->fbi.svert[0].z * 4096.0f);
v->fbi.dzdx = (INT32)(((v->fbi.svert[0].z - v->fbi.svert[1].z) * dx1 - (v->fbi.svert[0].z - v->fbi.svert[2].z) * dx2) * tdiv);
v->fbi.dzdy = (INT32)(((v->fbi.svert[0].z - v->fbi.svert[2].z) * dy1 - (v->fbi.svert[0].z - v->fbi.svert[1].z) * dy2) * tdiv);
}

View File

@ -213,7 +213,7 @@ INLINE int millisec_to_samplecount( int millisec )
INLINE int tcycles_to_samplecount( int tcycles )
{
return (int) ((0.5 + (((double)TZX_WAV_FREQUENCY / 3500000) * (double)tcycles)) * t_scale);
return (int) ((0.5 + (((double)TZX_WAV_FREQUENCY / 3500000) * (double)tcycles)) * (double) t_scale);
}
static void tzx_output_wave( INT16 **buffer, int length )

View File

@ -642,7 +642,7 @@ bool core_options::set_value(const char *name, int value, int priority, std::str
bool core_options::set_value(const char *name, float value, int priority, std::string &error_string)
{
std::string tempstr;
strprintf(tempstr, "%f", value);
strprintf(tempstr, "%f", (double) value);
return set_value(name, tempstr.c_str(), priority, error_string);
}
@ -780,7 +780,7 @@ bool core_options::validate_and_set_data(core_options::entry &curentry, const ch
strcatprintf(error_string, "Illegal float value for %s: \"%s\"; reverting to %s\n", curentry.name(), data.c_str(), curentry.value());
return false;
}
if (curentry.has_range() && (fval < atof(curentry.minimum()) || fval > atof(curentry.maximum())))
if (curentry.has_range() && ((double) fval < atof(curentry.minimum()) || (double) fval > atof(curentry.maximum())))
{
strcatprintf(error_string, "Out-of-range float value for %s: \"%s\" (must be between %s and %s); reverting to %s\n", curentry.name(), data.c_str(), curentry.minimum(), curentry.maximum(), curentry.value());
return false;

View File

@ -511,7 +511,7 @@ xml_attribute_node *xml_set_attribute_int(xml_data_node *node, const char *name,
xml_attribute_node *xml_set_attribute_float(xml_data_node *node, const char *name, float value)
{
char buffer[100];
sprintf(buffer, "%f", value);
sprintf(buffer, "%f", (double) value);
return xml_set_attribute(node, name, buffer);
}

View File

@ -343,9 +343,9 @@ static imgtoolerr_t evaluate_module(const char *fname,
goto done;
if (ent.corrupt)
current_result = (current_result * 99 + 1.00) / 100;
current_result = (current_result * 99 + 1.00f) / 100;
else
current_result = (current_result + 1.00) / 2;
current_result = (current_result + 1.00f) / 2;
}
while(!ent.eof);
@ -429,7 +429,7 @@ imgtoolerr_t imgtool_identify_file(const char *fname, imgtool_module **modules,
goto done;
insert_module = module;
for (i = 0; (val > 0.0) && (i < count); i++)
for (i = 0; (val > 0.0f) && (i < count); i++)
{
if (val > values[i])
{