//>>built
define("dojox/encoding/bits",["dojo/_base/lang"],function(e){var d=e.getObject("dojox.encoding.bits",!0);d.OutputStream=function(){this.reset()};e.extend(d.OutputStream,{reset:function(){this.buffer=[];this.accumulator=0;this.available=8},putBits:function(b,a){for(;a;){var c=Math.min(a,this.available);this.accumulator|=(c<=a?b>>>a-c:b)<<this.available-c&255>>>8-this.available;this.available-=c;this.available||(this.buffer.push(this.accumulator),this.accumulator=0,this.available=8);a-=c}},getWidth:function(){return 8*
this.buffer.length+(8-this.available)},getBuffer:function(){var b=this.buffer;8>this.available&&b.push(this.accumulator&255<<this.available);this.reset();return b}});d.InputStream=function(b,a){this.buffer=b;this.width=a;this.bbyte=this.bit=0};e.extend(d.InputStream,{getBits:function(b){for(var a=0;b;){var c=Math.min(b,8-this.bit),d=this.buffer[this.bbyte]>>>8-this.bit-c,a=a<<c,a=a|d&~(-1<<c);this.bit+=c;8==this.bit&&(++this.bbyte,this.bit=0);b-=c}return a},getWidth:function(){return this.width-8*
this.bbyte-this.bit}});return d});