And what's the advantage of packing like this? It would seem all you do is add a lot more shifts to insert/retrieve the value. I don't see the benefit.
So what if you're storing 0x00000001 and 0x00010000. Same space, only one shift and an or/and to insert/retrieve necessary. Michael D. Black Senior Scientist NG Information Systems Advanced Analytics Directorate ________________________________________ From: [email protected] [[email protected]] on behalf of Max Vlasov [[email protected]] Sent: Wednesday, February 09, 2011 3:06 PM To: General Discussion of SQLite Database Subject: Re: [sqlite] EXT :Re: Bi-directional unique Michael, another small improvement... to take advantage of effective integer packing you can encode two numbers interleaving them dedicating odd bits to one and even to another. This will require extra steps in the program so this is your turn to decide worth it or not. Max On Wed, Feb 9, 2011 at 10:35 PM, Black, Michael (IS) <[email protected] > wrote: > I think I can get away with 31 bits (I'll have to add some error checking > just in case). > > I like this idea as it collapses into a single field that is easily > indexed. > > ... > ________________________________________ > From: [email protected] [[email protected]] on > behalf of Jim Wilcoxson [[email protected]] > > > If you don't care about the order and the integers are smallish, like 31 > bits or less, I'd do this: > > create table t(k int primary key); > > i = whatever > j = whatever > if i < j: > k = i<<32 | j > else: > k = j<<32 | i > insert k into table > > _______________________________________________ sqlite-users mailing list [email protected] http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users _______________________________________________ sqlite-users mailing list [email protected] http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

