@JRubyMethod(name = "adler32_combine", required = 3, module = true, visibility = PRIVATE) public static IRubyObject adler32_combine(IRubyObject recv, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2) { long adler1 = RubyNumeric.num2long(arg0); long adler2 = RubyNumeric.num2long(arg1); long len2 = RubyNumeric.num2long(arg2); long adler3 = com.jcraft.jzlib.JZlib.adler32_combine(adler1, adler2, len2); return recv.getRuntime().newFixnum(adler3); }
@JRubyMethod(name = "crc32_combine", required = 3, module = true, visibility = PRIVATE) public static IRubyObject crc32_combine(IRubyObject recv, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2) { long crc1 = RubyNumeric.num2long(arg0); long crc2 = RubyNumeric.num2long(arg1); long len2 = RubyNumeric.num2long(arg2); long crc3 = com.jcraft.jzlib.JZlib.crc32_combine(crc1, crc2, len2); return recv.getRuntime().newFixnum(crc3); }
@JRubyMethod(name = "adler32_combine", required = 3, module = true, visibility = PRIVATE) public static IRubyObject adler32_combine(IRubyObject recv, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2) { long adler1 = RubyNumeric.num2long(arg0); long adler2 = RubyNumeric.num2long(arg1); long len2 = RubyNumeric.num2long(arg2); long adler3 = com.jcraft.jzlib.JZlib.adler32_combine(adler1, adler2, len2); return recv.getRuntime().newFixnum(adler3); }
@JRubyMethod(name = "crc32_combine", required = 3, module = true, visibility = PRIVATE) public static IRubyObject crc32_combine(IRubyObject recv, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2) { long crc1 = RubyNumeric.num2long(arg0); long crc2 = RubyNumeric.num2long(arg1); long len2 = RubyNumeric.num2long(arg2); long crc3 = com.jcraft.jzlib.JZlib.crc32_combine(crc1, crc2, len2); return recv.getRuntime().newFixnum(crc3); }
@JRubyMethod(name = "adler32_combine", required = 3, module = true, visibility = PRIVATE) public static IRubyObject adler32_combine(IRubyObject recv, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2) { long adler1 = RubyNumeric.num2long(arg0); long adler2 = RubyNumeric.num2long(arg1); long len2 = RubyNumeric.num2long(arg2); long adler3 = com.jcraft.jzlib.JZlib.adler32_combine(adler1, adler2, len2); return recv.getRuntime().newFixnum(adler3); }
@JRubyMethod(name = "crc32_combine", required = 3, module = true, visibility = PRIVATE) public static IRubyObject crc32_combine(IRubyObject recv, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2) { long crc1 = RubyNumeric.num2long(arg0); long crc2 = RubyNumeric.num2long(arg1); long len2 = RubyNumeric.num2long(arg2); long crc3 = com.jcraft.jzlib.JZlib.crc32_combine(crc1, crc2, len2); return recv.getRuntime().newFixnum(crc3); }
@JRubyMethod(name = "adler32_combine", required = 3, module = true, visibility = PRIVATE) public static IRubyObject adler32_combine(IRubyObject recv, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2) { long adler1 = RubyNumeric.num2long(arg0); long adler2 = RubyNumeric.num2long(arg1); long len2 = RubyNumeric.num2long(arg2); long adler3 = com.jcraft.jzlib.JZlib.adler32_combine(adler1, adler2, len2); return recv.getRuntime().newFixnum(adler3); }
@JRubyMethod(name = "crc32_combine", required = 3, module = true, visibility = PRIVATE) public static IRubyObject crc32_combine(IRubyObject recv, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2) { long crc1 = RubyNumeric.num2long(arg0); long crc2 = RubyNumeric.num2long(arg1); long len2 = RubyNumeric.num2long(arg2); long crc3 = com.jcraft.jzlib.JZlib.crc32_combine(crc1, crc2, len2); return recv.getRuntime().newFixnum(crc3); }
@JRubyMethod(name = "adler32", optional = 2, module = true, visibility = PRIVATE) public static IRubyObject adler32(IRubyObject recv, IRubyObject[] args) { args = Arity.scanArgs(recv.getRuntime(),args,0,2); int start = 1; ByteList bytes = null; if (!args[0].isNil()) bytes = args[0].convertToString().getByteList(); if (!args[1].isNil()) start = (int)RubyNumeric.num2long(args[1]); Adler32 checksum = new Adler32(); if (bytes != null) { checksum.update(bytes.getUnsafeBytes(), bytes.begin(), bytes.length()); } long result = checksum.getValue(); if (start != 1) { result = JZlib.adler32_combine(start, result, bytes.length()); } return recv.getRuntime().newFixnum(result); }
@JRubyMethod(name = "crc32", optional = 2, module = true, visibility = PRIVATE) public static IRubyObject crc32(IRubyObject recv, IRubyObject[] args) { args = Arity.scanArgs(recv.getRuntime(),args,0,2); long start = 0; ByteList bytes = null; if (!args[0].isNil()) bytes = args[0].convertToString().getByteList(); if (!args[1].isNil()) start = RubyNumeric.num2long(args[1]); start &= 0xFFFFFFFFL; final boolean slowPath = start != 0; final int bytesLength = bytes == null ? 0 : bytes.length(); long result = 0; if (bytes != null) { CRC32 checksum = new CRC32(); checksum.update(bytes.getUnsafeBytes(), bytes.begin(), bytesLength); result = checksum.getValue(); } if (slowPath) { result = JZlib.crc32_combine(start, result, bytesLength); } return recv.getRuntime().newFixnum(result); }
@JRubyMethod(name = "adler32", optional = 2, module = true, visibility = PRIVATE) public static IRubyObject adler32(IRubyObject recv, IRubyObject[] args) { args = Arity.scanArgs(recv.getRuntime(),args,0,2); int start = 1; ByteList bytes = null; if (!args[0].isNil()) bytes = args[0].convertToString().getByteList(); if (!args[1].isNil()) start = (int)RubyNumeric.num2long(args[1]); Adler32 checksum = new Adler32(); if (bytes != null) { checksum.update(bytes.getUnsafeBytes(), bytes.begin(), bytes.length()); } long result = checksum.getValue(); if (start != 1) { result = JZlib.adler32_combine(start, result, bytes.length()); } return recv.getRuntime().newFixnum(result); }
@JRubyMethod(name = "crc32", optional = 2, module = true, visibility = PRIVATE) public static IRubyObject crc32(IRubyObject recv, IRubyObject[] args) { args = Arity.scanArgs(recv.getRuntime(),args,0,2); long start = 0; ByteList bytes = null; if (!args[0].isNil()) bytes = args[0].convertToString().getByteList(); if (!args[1].isNil()) start = RubyNumeric.num2long(args[1]); start &= 0xFFFFFFFFL; final boolean slowPath = start != 0; final int bytesLength = bytes == null ? 0 : bytes.length(); long result = 0; if (bytes != null) { CRC32 checksum = new CRC32(); checksum.update(bytes.getUnsafeBytes(), bytes.begin(), bytesLength); result = checksum.getValue(); } if (slowPath) { result = JZlib.crc32_combine(start, result, bytesLength); } return recv.getRuntime().newFixnum(result); }