Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| From | David Brown <david.brown@hesbynett.no> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: What's the best hashing function? |
| Date | 2015-09-17 10:24 +0200 |
| Organization | A noiseless patient Spider |
| Message-ID | <mtdt7h$th0$1@dont-email.me> (permalink) |
| References | (4 earlier) <87a8smdx1g.fsf@bsb.me.uk> <e7f60185-f0f5-4b72-aa3b-44f4dac05d3c@googlegroups.com> <87oah2cbdw.fsf@bsb.me.uk> <0c49b342-756f-4e57-a4ab-ea60d011a622@googlegroups.com> <15e5217d-9101-4b82-bba5-f896c0f43279@googlegroups.com> |
On 16/09/15 23:48, fir wrote:
> W dniu środa, 16 września 2015 23:33:49 UTC+2 użytkownik fir
> napisał:
>> W dniu środa, 16 września 2015 23:17:24 UTC+2 użytkownik Ben
>> Bacarisse napisał:
>>> fir <profesor.fir@gmail.com> writes: <snip>
>>>>>>> On 2015.09.16 13:35, fir wrote:
>>>>>>>> I encountered recently some example like this, Though i
>>>>>>>> not tested it
>>>>>>>>
>>>>>>>> its in jave i dont know what >>> means
>>>>>>>>
>>>>>>>> /** Robert Jenkins' 96 bit Mix Function. */ private
>>>>>>>> static int mix(int a, int b, int c) { a=a-b; a=a-c;
>>>>>>>> a=a^(c >>> 13); b=b-c; b=b-a; b=b^(a << 8); c=c-a;
>>>>>>>> c=c-b; c=c^(b >>> 13); a=a-b; a=a-c; a=a^(c >>>
>>>>>>>> 12); b=b-c; b=b-a; b=b^(a << 16); c=c-a; c=c-b;
>>>>>>>> c=c^(b >>> 5); a=a-b; a=a-c; a=a^(c >>> 3); b=b-c;
>>>>>>>> b=b-a; b=b^(a << 10); c=c-a; c=c-b; c=c^(b >>> 15);
>>>>>>>> return c; }
>>> <snip>
>>>> so in short it means it is inpossible to revrite it to c?
>>>
>>> No, that's not it at all. It should be obvious that a C re-write
>>> is possible. The only question is how much effort do you want to
>>> put in to make the code have *exactly* the same semantics on
>>> *every* conforming C implementation. The answer is none,
>>> because, ironically, the original Jenkins hash function was
>>> written C. The Java re-write has been forced to use signed
>>> integers (presumably it's old Java) and has therefore has altered
>>> the semantics (though probably not at the bit-level). Anyway,
>>> just use the original C version.
>>>
>>> Or even use one of the newer hash function he's designed like:
>>> http://www.burtleburtle.net/bob/hash/spooky.html
>>>
>>
>> aa-h, okay though if this particular example has its easy
>> correspondent doesnt probably neccessary mean that all code that
>> uses signed or unsigned shifts on negative integers can be
>> revritten (and thats a bit worry - they should gave at least all
>> those intrinsics in gcc if x86 supports it (and x86 afaik supports
>> a wide wariety of shifts)
>>
>> I vote for gcc intrinsics for all the x86 usable assembly to use
>> (intrinsics should be probably standard term in c, as its great
>> usability (not necessary 'portab;e' 9avaliable on all c targets,
>> but as a platform dependant parts of stdlib or something (who said
>> stdlib must be all portable) ) **
>>
>> (** it all untill ev some more organisation will be done, as im not
>> great fan of clib at all, but intrinsics are at least extreamly
>> usable 'patch' for platforms (or seems so))
>
> this is word on c standard (that maybe those people who care much
> about standard should be interested maybe on this topic) ->
>
> it is okay that c is designed to work on so wide variety of platforms
> and thus has so many undefined parts ((though c has also iirc some
> undefined parts that are not justified by different platform
> behaviours - those maybe should be just defined))
>
> but if so c should also probably standarize some platform dependant
> parts by some groups of platforms 9it seems so), for example if the
> talk is x86 platform or alike, there is need of standarisation those
> outa-core-standard parts across gcc-vs-clang or what else; becouse if
> no it is practically silly (behaviours that could be
> agreed/coordinated on platforms are not..
>
There are far too many different platforms and targets for C for this to
make sense. And these days, C is a minor (but vitally important)
language on x86, especially with Windows - while it is the biggest
choice by far on embedded systems. So gcc supports some 30+ target
processors, and they have no interest in trying to make intrinsics for
all opcodes on all platforms. There is already a way to handle that -
it's called assembly, with gcc inline assembly for mixing it with C code.
For many targets, gcc /does/ have intrinsics for some of the most
commonly needed opcodes that are not easily expressed in C. Thus there
are intrinsics for a lot of SIMD stuff on x86, or atomic access
instructions.
> - this leads admittedly to some c variants, like c-x86 c-something
> other , but better that than nothing (probably))
>
>
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: What's the best hashing function? fir <profesor.fir@gmail.com> - 2015-09-16 09:35 -0700
Re: What's the best hashing function? "D. Aaron Sawyer" <aaron@110.net> - 2015-09-16 14:22 -0300
Re: What's the best hashing function? fir <profesor.fir@gmail.com> - 2015-09-16 10:59 -0700
Re: What's the best hashing function? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-09-16 19:44 +0100
Re: What's the best hashing function? fir <profesor.fir@gmail.com> - 2015-09-16 12:32 -0700
Re: What's the best hashing function? Bartc <bc@freeuk.com> - 2015-09-16 20:40 +0100
Re: What's the best hashing function? Keith Thompson <kst-u@mib.org> - 2015-09-16 13:11 -0700
Re: What's the best hashing function? "James Harris" <james.harris.1@gmail.com> - 2015-09-16 21:16 +0100
Re: What's the best hashing function? fir <profesor.fir@gmail.com> - 2015-09-16 13:47 -0700
Re: What's the best hashing function? fir <profesor.fir@gmail.com> - 2015-09-16 14:14 -0700
Re: What's the best hashing function? Robert Wessel <robertwessel2@yahoo.com> - 2015-09-16 18:08 -0500
Re: What's the best hashing function? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-09-17 00:13 +0100
Re: What's the best hashing function? fir <profesor.fir@gmail.com> - 2015-09-20 01:13 -0700
Re: What's the best hashing function? Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-09-16 13:10 -0700
Re: What's the best hashing function? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-09-16 22:17 +0100
Re: What's the best hashing function? fir <profesor.fir@gmail.com> - 2015-09-16 14:33 -0700
Re: What's the best hashing function? fir <profesor.fir@gmail.com> - 2015-09-16 14:48 -0700
Re: What's the best hashing function? fir <profesor.fir@gmail.com> - 2015-09-16 14:58 -0700
Re: What's the best hashing function? Robert Wessel <robertwessel2@yahoo.com> - 2015-09-16 18:13 -0500
Re: What's the best hashing function? supercat@casperkitty.com - 2015-09-16 16:29 -0700
Re: What's the best hashing function? David Brown <david.brown@hesbynett.no> - 2015-09-17 10:17 +0200
Re: What's the best hashing function? Keith Thompson <kst-u@mib.org> - 2015-09-17 08:53 -0700
Re: What's the best hashing function? supercat@casperkitty.com - 2015-09-17 11:29 -0700
Re: What's the best hashing function? David Brown <david.brown@hesbynett.no> - 2015-09-18 10:07 +0200
Re: What's the best hashing function? Richard Heathfield <rjh@cpax.org.uk> - 2015-09-18 09:20 +0100
Re: What's the best hashing function? supercat@casperkitty.com - 2015-09-18 09:25 -0700
Re: What's the best hashing function? David Brown <david.brown@hesbynett.no> - 2015-09-18 19:45 +0200
Re: What's the best hashing function? supercat@casperkitty.com - 2015-09-18 11:47 -0700
Re: What's the best hashing function? David Brown <david.brown@hesbynett.no> - 2015-09-18 21:49 +0200
Re: What's the best hashing function? supercat@casperkitty.com - 2015-09-18 14:50 -0700
Re: What's the best hashing function? Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-09-19 00:23 -0700
Re: What's the best hashing function? David Brown <david.brown@hesbynett.no> - 2015-09-19 11:13 +0200
Re: What's the best hashing function? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-09-19 11:03 +0100
Re: What's the best hashing function? David Brown <david.brown@hesbynett.no> - 2015-09-19 12:38 +0200
Re: What's the best hashing function? supercat@casperkitty.com - 2015-09-21 11:29 -0700
Re: What's the best hashing function? David Brown <david.brown@hesbynett.no> - 2015-09-22 10:23 +0200
Re: What's the best hashing function? Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-09-22 02:31 -0700
Re: What's the best hashing function? supercat@casperkitty.com - 2015-09-22 11:28 -0700
Re: What's the best hashing function? supercat@casperkitty.com - 2015-09-22 11:18 -0700
Re: What's the best hashing function? David Brown <david.brown@hesbynett.no> - 2015-09-17 10:24 +0200
Re: What's the best hashing function? fir <profesor.fir@gmail.com> - 2015-09-17 01:48 -0700
Re: What's the best hashing function? fir <profesor.fir@gmail.com> - 2015-09-17 01:56 -0700
Re: What's the best hashing function? fir <profesor.fir@gmail.com> - 2015-09-17 02:09 -0700
Re: What's the best hashing function? Keith Thompson <kst-u@mib.org> - 2015-09-16 14:49 -0700
Re: What's the best hashing function? glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2015-09-16 21:56 +0000
Re: What's the best hashing function? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-09-16 23:37 +0100
Re: What's the best hashing function? supercat@casperkitty.com - 2015-09-16 13:02 -0700
Re: What's the best hashing function? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-09-16 21:57 +0100
Re: What's the best hashing function? supercat@casperkitty.com - 2015-09-16 14:16 -0700
Re: What's the best hashing function? glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2015-09-16 21:57 +0000
Re: What's the best hashing function? supercat@casperkitty.com - 2015-09-16 16:20 -0700
csiph-web