Android Question Calc CheckSum

trvip

Member
hi
how can i convert this js code to b4x?

JavaScript:
calculateChecksum: function(file, offset, length)
    {
        var old = file.seek(offset);
        var sum = 0;
        var nlongs = ((length + 3) / 4) | 0;
        while( nlongs-- ) {
            sum = (sum + file.getUint32() & 0xffffffff) >>> 0;
        }

        file.seek(old);
        return sum;
    }

thx..
 
Top