Murmur下载_highwayhash

Murmur下载_highwayhashpackageorg.videolan.vlc;/**Murmurhash2.0.**Themurmurhashisarelativefasthashfunctionfrom*http://murmurhash.googlepages.com/forplatformswithefficient*multiplication.**Thisisare-i…

大家好,又见面了,我是你们的朋友全栈君。如果您正在找激活码,请点击查看最新教程,关注关注公众号 “全栈程序员社区” 获取激活教程,可能之前旧版本教程已经失效.最新Idea2022.1教程亲测有效,一键激活。

Jetbrains全系列IDE稳定放心使用

package org.videolan.vlc;

/** Murmur hash 2.0.

*

* The murmur hash is a relative fast hash function from

* http://murmurhash.googlepages.com/ for platforms with efficient

* multiplication.

*

* This is a re-implementation of the original C code plus some

* additional features.

*

* Public domain.

*

* @author Viliam Holub

* @version 1.0.2

*

*/

public final class MurmurHash {

/** Generates 32 bit hash from byte array of the given length and

* seed.

*

* @param data byte array to hash

* @param length length of the array to hash

* @param seed initial seed value

* @return 32 bit hash of the given array

*/

public static int hash32(final byte[] data, int length, int seed) {

// ‘m’ and ‘r’ are mixing constants generated offline.

// They’re not really ‘magic’, they just happen to work well.

final int m = 0x5bd1e995;

final int r = 24;

// Initialize the hash to a random value

int h = seed ^ length;

int length4 = length / 4;

for (int i = 0; i < length4; i++) {

final int i4 = i * 4;

int k = (data[i4 + 0] & 0xff) + ((data[i4 + 1] & 0xff) << 8)

+ ((data[i4 + 2] & 0xff) << 16) + ((data[i4 + 3] & 0xff) << 24);

k *= m;

k ^= k >>> r;

k *= m;

h *= m;

h ^= k;

}

// Handle the last few bytes of the input array

switch (length % 4) {

case 3:

h ^= (data[(length & ~3) + 2] & 0xff) << 16;

case 2:

h ^= (data[(length & ~3) + 1] & 0xff) << 8;

case 1:

h ^= (data[length & ~3] & 0xff);

h *= m;

}

h ^= h >>> 13;

h *= m;

h ^= h >>> 15;

return h;

}

/** Generates 32 bit hash from byte array with default seed value.

*

* @param data byte array to hash

* @param length length of the array to hash

* @return 32 bit hash of the given array

*/

public static int hash32(final byte[] data, int length) {

return hash32(data, length, 0x9747b28c);

}

/** Generates 32 bit hash from a string.

*

* @param text string to hash

* @return 32 bit hash of the given string

*/

public static int hash32(final String text) {

final byte[] bytes = text.getBytes();

return hash32(bytes, bytes.length);

}

/** Generates 32 bit hash from a substring.

*

* @param text string to hash

* @param from starting index

* @param length length of the substring to hash

* @return 32 bit hash of the given string

*/

public static int hash32(final String text, int from, int length) {

return hash32(text.substring(from, from + length));

}

/** Generates 64 bit hash from byte array of the given length and seed.

*

* @param data byte array to hash

* @param length length of the array to hash

* @param seed initial seed value

* @return 64 bit hash of the given array

*/

public static long hash64(final byte[] data, int length, int seed) {

final long m = 0xc6a4a7935bd1e995L;

final int r = 47;

long h = (seed & 0xffffffffl) ^ (length * m);

int length8 = length / 8;

for (int i = 0; i < length8; i++) {

final int i8 = i * 8;

long k = ((long) data[i8 + 0] & 0xff) + (((long) data[i8 + 1] & 0xff) << 8)

+ (((long) data[i8 + 2] & 0xff) << 16) + (((long) data[i8 + 3] & 0xff) << 24)

+ (((long) data[i8 + 4] & 0xff) << 32) + (((long) data[i8 + 5] & 0xff) << 40)

+ (((long) data[i8 + 6] & 0xff) << 48) + (((long) data[i8 + 7] & 0xff) <<

(完整源码请下载查看)

展开> <收缩

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/180411.html原文链接:https://javaforall.net

(0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • 【工具使用】应用层DNS协议工具—iodine

    【工具使用】应用层DNS协议工具—iodine0x01iodine 工具介绍 iodine 工具是基于 C 语言开发的 分为服务端程序 iodined 和客户端 iodine iodine 支持 EDNS base32 base64 base128 等多种编码规范 iodine 支持转发模式和中继模式 iodine 原理 通过 TAP 虚拟网卡 在服务端建立一个局域网 在客户端 通过 TAP 建立一个虚拟网卡 两者通过 DNS 隧道连接 处于同一局域网 可以通过 ping 命令通信 在客户端和服务端之间建立连接后 客户机上会多出一块 dns0 的虚拟网卡 DNS 隧道

    2025年6月21日
    1
  • vim的复制粘贴命令_linux vim全选复制

    vim的复制粘贴命令_linux vim全选复制一、最基本的复制粘贴1.将光标移动到要复制的文本开始的地方,按v进入可视模式。2.将光标移动到要复制的文本的结束的地方,按y复制。此时vim会自动将光标定位到选中文本的开始的地方,并退出可视模式。3.移动光标到文本结束的地方,按p粘贴。…

    2022年9月2日
    2
  • Visual Studio 2019 Community 离线注册教程「建议收藏」

    Visual Studio 2019 Community 离线注册教程「建议收藏」VS2019社区版是免费的,但是需要登录微软账户,不登录只能使用30天,30天之后就无法使用了,如下图:首先使用能够访问外网的电脑登录微软账户注册VS。也可以使用我这个Licensing,直接进入第三步 找到注册文件,路径:C:\Users\{系统登录用户}\AppData\Local\Microsoft\VSCommon 将两个文件夹复制到需要注册的电脑上,路径:C:\…

    2022年10月13日
    0
  • java堆栈详解

    java堆栈详解java虚拟机栈栈是线程私有,他的生命周期和线程的相同。用于存储局部变量,操作数栈,动态链接,方法出口等。他会抛出两种异常,stackoverflowerror异常和outofmemoryerror异常。java虚拟机堆堆是线程共有的一块内存区域,在虚拟机启动时创建,为了存放对象实例。java堆是垃圾收集器管理的主要区域,因此很多时候被称为“GC堆”。java堆可以处于物理上不连续的内

    2022年7月8日
    20
  • java冒泡排序经典代码_java冒泡排序[通俗易懂]

    java冒泡排序经典代码_java冒泡排序[通俗易懂]经典算法——冒泡排序(BubbleSort)一、示例代码(伸手党看这里)1.示例一importjava.util.Arrays;publicclassBubbleSort{publicstaticvoidbubbleSort(int[]arr){inttemp;/*临时变量,交换数据时使用*/intlength=arr.length;for(intp=length-1…

    2022年6月22日
    36
  • Windows Server 2016 检查更新时,错误代码8024401C 的解决方案 …

    Windows Server 2016 检查更新时,错误代码8024401C 的解决方案 …这个问题的核心是连接不到更新服务器,有多种解决方案(如给SoftwareDistribution改名、疑难解答等),还有一部分情况是因为IPV6导致,关闭IPV6即可解决。如果其他办法都不好用可以试试这个~WindowsServer关闭ipv6的办法:开始->运行->输入Regedit进入注册表编辑器定位到:[HKEY_…

    2022年6月10日
    44

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号