Search found 574 matches

by Stonemonkey
Dec 08, 2019 11:08
Forum: General
Topic: Squares
Replies: 7357
Views: 442472

Re: Squares

@albert I posted code to do that a page or two back. Change the '4' in the main sub to value from 1 to 4 to get permutations containing 1 to 4 different digits. function make_map(byval b as ulong)as ulong return (1 shl(b and 3))or(1 shl((b shr 2)and 3))or(1 shl((b shr 4)and 3))or(1 shl((b shr 6)and ...
by Stonemonkey
Dec 05, 2019 19:13
Forum: General
Topic: Squares
Replies: 7357
Views: 442472

Re: Squares

But was he able to bring all the sheep back?
by Stonemonkey
Dec 03, 2019 20:13
Forum: General
Topic: Squares
Replies: 7357
Views: 442472

Re: Squares

@albert, looks like you've got 0x and x0 giving out the same code.
by Stonemonkey
Dec 01, 2019 10:22
Forum: General
Topic: Squares
Replies: 7357
Views: 442472

Re: Squares

@albert
Sorry, I thought you meant permutations of the sequence containing the digits 1,2,3 and 4
by Stonemonkey
Nov 30, 2019 23:13
Forum: General
Topic: Squares
Replies: 7357
Views: 442472

Re: Squares

28 combinations is 4.8 bits.
by Stonemonkey
Nov 30, 2019 11:12
Forum: Tips and Tricks
Topic: CPU burn test
Replies: 8
Views: 454

Re: CPU burn test

Just some thoughts, i don't know much about it but maybe more randomish memory addressing when you're accessing the array would push the cache more, then there's also the SSE units that you might not be touching with that code, depends if the compiler uses the FPU or SSE instructions, but even if it...
by Stonemonkey
Nov 29, 2019 20:06
Forum: General
Topic: Squares
Replies: 7357
Views: 442472

Re: Squares

@Albert Try changing the '4' in the main sub to a value from 1 to 4 and see what the output is too. function make_map(byval b as ulong)as ulong return (1 shl(b and 3))or(1 shl((b shr 2)and 3))or(1 shl((b shr 4)and 3))or(1 shl((b shr 6)and 3)) end function function count_set_bits(byval b as ulong)as ...
by Stonemonkey
Nov 28, 2019 17:24
Forum: General
Topic: Squares
Replies: 7357
Views: 442472

Re: Squares

@albert

Code: Select all

dim as string a="Hello World"
dim as ubyte ptr c=cptr(ubyte ptr,strptr(a))

for i as integer=0 to 5
    print chr$(c[i])
    c[i]=asc("*")
next

print a
sleep
end
by Stonemonkey
Nov 28, 2019 13:02
Forum: General
Topic: Squares
Replies: 7357
Views: 442472

Re: Squares

Might a string pointer be a pointer pointer?

Dim as ubyte ptr ptr p=cast(....

ubyte_=**p

Or something like that?

Accessing other bytes might need something like

ubyte_=*(*p)[n]
Or something like that, i dunno, at work just now and can't look into it.
by Stonemonkey
Nov 27, 2019 20:16
Forum: General
Topic: Squares
Replies: 7357
Views: 442472

Re: Squares

Here's the idea i mentioned before implemented, whether or not it's a pair of octs or they're different isn't stored in the compression so the decompression routine looks through all combinations and finds which are possible. sometimes there are leading 0's in the source so the compressed data can l...
by Stonemonkey
Nov 27, 2019 9:53
Forum: General
Topic: Squares
Replies: 7357
Views: 442472

Re: Squares

@albert If I was looking at 2 x 3bits, there are 28 combinations of 2 values and 8 combinations of 1 value giving a total of 36 combinations so the map reduces to 5.17 bits, when they're both the same value then no other data is required but if they're different then 1 extra bit is required for the ...
by Stonemonkey
Nov 26, 2019 15:27
Forum: General
Topic: Squares
Replies: 7357
Views: 442472

Re: Squares

@richard

So this will be the thread to post my compression code too. Hopefully I can keep up with Albert.
by Stonemonkey
Nov 26, 2019 12:55
Forum: General
Topic: Squares
Replies: 7357
Views: 442472

Re: Squares

@Richard

Ah, so if I just remove all the 0's from every byte or replace all 0's with 11, that counts as compression and I just need someone to work out a way to insert those 0's back in or find out which pairs of 1's represent 0?
by Stonemonkey
Nov 26, 2019 11:38
Forum: General
Topic: Squares
Replies: 7357
Views: 442472

Re: Squares

@albert, I'm not really sure I'm following what you're doing, don't you need to be able to show it's possible to restore the original data before you can claim it's compression? Or am I missing something?
by Stonemonkey
Nov 25, 2019 23:05
Forum: General
Topic: Squares
Replies: 7357
Views: 442472

Re: Squares

@albert I hadn't done this before but it turns out encoding by nibbles is the most efficient base in terms of the size of the map that has to be stored. print "For encoding 4 elements at a time" print print "No of bits per element bits req'd for map bits free for ordering" for j ...

Go to advanced search