mirror of
https://github.com/elua/elua.git
synced 2025-01-25 01:02:54 +08:00
Fix to previous commit: unsigned values never look negative!
This commit is contained in:
parent
84a17973fb
commit
b72f620aed
@ -28,14 +28,16 @@ static int adc_maxval( lua_State* L )
|
||||
// Lua: realclock = setclock( id, freq, [timer_id] )
|
||||
static int adc_setclock( lua_State* L )
|
||||
{
|
||||
s32 sfreq; // signed version for negative checking
|
||||
u32 freq;
|
||||
unsigned id, timer_id = 0;
|
||||
|
||||
id = luaL_checkinteger( L, 1 );
|
||||
MOD_CHECK_ID( adc, id );
|
||||
freq = luaL_checkinteger( L, 2 );
|
||||
if ( freq < 0 )
|
||||
sfreq = luaL_checkinteger( L, 2 );
|
||||
if ( sfreq < 0 )
|
||||
return luaL_error( L, "frequency must be 0 or positive" );
|
||||
freq = ( u32 ) sfreq;
|
||||
if ( freq > 0 )
|
||||
{
|
||||
timer_id = luaL_checkinteger( L, 3 );
|
||||
|
Loading…
x
Reference in New Issue
Block a user