## Search found 574 matches

### 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 ...

### Re: Squares

But was he able to bring all the sheep back?

### Re: Squares

@albert, looks like you've got 0x and x0 giving out the same code.

### Re: Squares

@albert

Sorry, I thought you meant permutations of the sequence containing the digits 1,2,3 and 4

Sorry, I thought you meant permutations of the sequence containing the digits 1,2,3 and 4

### Re: Squares

28 combinations is 4.8 bits.

- 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...

### 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 ...

### 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

### 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.

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.

### 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...

### 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 ...

### Re: Squares

@richard

So this will be the thread to post my compression code too. Hopefully I can keep up with Albert.

So this will be the thread to post my compression code too. Hopefully I can keep up with Albert.

### 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?

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?

### 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?

### 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 ...