readme.txt 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. 由于il2cpp在4.6.3下存在如下bug导致sharpzipLib无法使用:
  2. bug如下:
  3. byte b = 205;
  4. Debug.Log( (b & 0xff) << 8)
  5. 在il2cpp下表达式计算是0
  6. 修改sharpzipLib源码,规避上述bug
  7. 1.StreamManipulator类PeekBits函数修改如下
  8. public int PeekBits(int bitCount)
  9. {
  10. if (bitsInBuffer_ < bitCount) {
  11. if (windowStart_ == windowEnd_) {
  12. return -1; // ok
  13. }
  14. int tmp1 = window_[windowStart_++] & 0xff;
  15. int tmp2 = window_[windowStart_++] & 0xff;
  16. buffer_ |= (uint)((tmp1 | tmp2 << 8) << bitsInBuffer_);
  17. bitsInBuffer_ += 16;
  18. }
  19. return (int)(buffer_ & ((1 << bitCount) - 1));
  20. }
  21. 2.DeflaterHuffman类BitReverse函数修改如下:
  22. public static short BitReverse(int toReverse)
  23. {
  24. int t1 = bit4Reverse[toReverse & 0xF];
  25. int t2 = bit4Reverse[(toReverse >> 4) & 0xF];
  26. int t3 = bit4Reverse[(toReverse >> 8) & 0xF];
  27. int t4 = bit4Reverse[(toReverse >> 12) & 0xF];
  28. int t5 = t1 << 12;
  29. int t6 = t2 << 8;
  30. int t7 = t3 << 4;
  31. int t8 = t4 << 0;
  32. return (short) (t5 | t6 | t7 | t8);
  33. }