This conversion may fail at runtime ..
crc=~crc.
I cannot tell why.
Here is the code:
function CRC_Check_Pol(data_byte_array : char[], crc_bytes : char, DATA_BYTE_SIZE : Number)
{
/*CRC - 8*/
var crc :char;
crc=0xFF;
var byte_indx; //index for data_byte_array
for ( byte_index=0x00; byte_indx< DATA_BYTE_SIZE; byte_indx++){
crc = table[(data_byte_array[byte_indx] ^ crc)];
}
crc = ~crc;
I will include the lookup table if its necessary (it is an array of bytes in hex).
I would be glad if you can give me hints what could cause the compile error.
From your comments you seem to be under the impression Javascript has BYTE and CHAR primitive types and therefore TypeScript should have them.
Javascript only has number
string
, boolean
, array
s and object
's (and undefined
& null
if you want to get technical). http://msdn.microsoft.com/en-us/library/ie/7wkd9z69(v=vs.94).aspx
TypeScript is just doing lots of nice compile-time checking for you (and providing various coding shortcuts). You need to find equivalent methods for doing each step in Javascript.