//>>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(a,b){for(;b;){var c=Math.min(b,this.available);this.accumulator|=(c<=b?a>>>b-c:a)<<this.available-c&255>>>8-this.available;this.available-=c;this.available||(this.buffer.push(this.accumulator),this.accumulator=0,this.available=8);b-=c}},getWidth:function(){return 8*
this.buffer.length+(8-this.available)},getBuffer:function(){var a=this.buffer;8>this.available&&a.push(this.accumulator&255<<this.available);this.reset();return a}});d.InputStream=function(a,b){this.buffer=a;this.width=b;this.bbyte=this.bit=0};e.extend(d.InputStream,{getBits:function(a){for(var b=0;a;){var c=Math.min(a,8-this.bit),f=this.buffer[this.bbyte]>>>8-this.bit-c;b<<=c;b|=f&~(-1<<c);this.bit+=c;8==this.bit&&(++this.bbyte,this.bit=0);a-=c}return b},getWidth:function(){return this.width-8*this.bbyte-
this.bit}});return d});