Long.js 403 B

12345678910111213141516
  1. export default class Long {
  2. constructor(high, low) {
  3. this.low = low || 0
  4. this.high = high || 0
  5. }
  6. static toBinaryString(i) {
  7. let mask
  8. let result = ''
  9. for (mask = 0x80000000; mask > 0; mask >>>= 1)
  10. result += (i.high & mask) === mask ? '1' : '0'
  11. for (mask = 0x80000000; mask > 0; mask >>>= 1)
  12. result += (i.low & mask) === mask ? '1' : '0'
  13. return result
  14. }
  15. }