define([ "dojo/_base/array", // array.forEach array.map "dojo/_base/declare", // declare "dojo/_base/lang", // lang.getObject, lang.hitch "dojo/string", // string.substitute "dojo/_base/window", // win.doc.createTextNode "dojo/on" ], function(array, declare, lang, string, window, on) { var module = declare("obno.core.util.bits", [], { }); module.s2b = function(s) { var b = []; for(var i = 0; i < s.length; ++i) { b.push(s.charCodeAt(i)); } return b; }; module.i2b = function(val){ var b = []; b[3] = (val >>> 0); b[2] = (val >>> 8); b[1] = (val >>> 16); b[0] = (val >>> 24); return b; }; module.b2i = function(b){ return ((b[3] & 0xFF) << 0) + ((b[2] & 0xFF) << 8) + ((b[1] & 0xFF) << 16) + ((b[0]) << 24); }; module.b2s = function(b) { var s = []; dojo.forEach(b, function(c){ s.push(String.fromCharCode(c)); }); return s.join(""); }; return module; });