dns-suite.js/node_modules/qap/bench/tables.js

12 lines
341 B
JavaScript
Raw Normal View History

2017-01-14 02:04:27 +00:00
module.exports = {
// bad char table
bcTable : function ( p ) {
var m = p.length,
bc = ( m > 255 ) ? [] : new Buffer( 256 ),
i = 0,
blen = bc.length || m;
for ( ; i < blen; bc[ i++ ] = m );
for ( i = 0; i < m - 1; ++i ) bc[ p[ i ] ] = m - i - 1;
return bc;
}
};