Skip to content

Instantly share code, notes, and snippets.

@jordwest
jordwest / bcd2number.js
Last active December 31, 2015 19:09 — forked from joaomaia/bcd2number.js
/**
* bcd2number -> takes a nodejs buffer with a BCD and returns the corresponding number.
* @param buffer The node.js Buffer object
* @param offset The byte offset in the buffer where the BCD starts
* @param length The number of bytes to read (a single byte represents 2 digits)
* @return number
*/
var bcd2number = function(buffer, offset, length)
{
var n = 0;