Remove unused code

This commit is contained in:
copy 2014-03-11 16:58:35 +01:00
parent 3ad72839d9
commit 57551c6a5a
2 changed files with 19 additions and 92 deletions

View file

@ -122,17 +122,6 @@ function dbg_assert(cond, msg, level)
};
Object.extend = function(target, src)
{
var keys = Object.keys(src);
for(var i = 0; i < keys.length; i++)
{
target[keys[i]] = src[keys[i]];
}
}
// pad string with spaces on the right
String.pads = function(str, len)
{
@ -159,18 +148,6 @@ String.pad0 = function(str, len)
return str;
}
Array.range = function(n)
{
var a = [];
for(var i = 0; i < n; i++)
{
a[i] = i;
}
return a;
}
/**
* number to hex
* @param {number=} len
@ -191,52 +168,6 @@ function h(n, len)
}
}
Number.bits = function(n)
{
var result = [];
for(var bit = 31; bit > -1; bit--)
{
if(n & 1 << bit)
{
result.push(bit);
}
}
return result.join(', ');
}
String.chr_repeat = function(chr, count)
{
var result = "";
while(count-- > 0)
{
result += chr;
}
return result;
}
Math.bcd_pack = function(n)
{
var i = 0,
result = 0,
digit;
while(n)
{
digit = n % 10;
result |= digit << (4 * i);
i++;
n = (n - digit) / 10;
}
return result;
}
/**
* Synchronous access to ArrayBuffer
* @constructor
@ -307,22 +238,6 @@ function CircularQueue(size)
this.clear();
}
// switch number to big endian
Math.to_be32 = function(dword)
{
return dword >>> 24 |
dword >> 8 & 0xff00 |
dword << 8 & 0xff0000 |
dword << 24;
}
Math.to_be16 = function(word)
{
return word >>> 8 & 0xff | word << 8 & 0xff00;
}
Math.int_log2 = function(x)
{
dbg_assert(x > 0);
@ -331,12 +246,6 @@ Math.int_log2 = function(x)
return (Math.log(x) / Math.LN2) | 0;
}
// round away from zero, opposite of truncation
Math.roundInfinity = function(x)
{
return x > 0 ? Math.ceil(x) : Math.floor(x);
};
/**
* @constructor

View file

@ -59,6 +59,24 @@ function RTC(dev, diskette_type, boot_order)
io.register_write(0x71, cmos_write);
io.register_read(0x71, cmos_read);
function bcd_pack(n)
{
var i = 0,
result = 0,
digit;
while(n)
{
digit = n % 10;
result |= digit << (4 * i);
i++;
n = (n - digit) / 10;
}
return result;
}
function encode_time(t)
{
if(cmos_b & 4)
@ -68,7 +86,7 @@ function RTC(dev, diskette_type, boot_order)
}
else
{
return Math.bcd_pack(t);
return bcd_pack(t);
}
}