# Search:

Type: Posts; User: hamster_nz

Page 1 of 13 1

1. ## Thread: 'unit8_t' undeclared (first use in this function)

by hamster_nz
Replies
6
Views
281

### You are seeing 3 because overflows are not...

You are seeing 3 because overflows are not errors.

Think of it like being 'clock' arithmetic, where 11:00 plus 3 hours equals 2:00.

For 8-bit unsigned numbers 0 follows after 255.
2. ## Thread: 'unit8_t' undeclared (first use in this function)

by hamster_nz
Replies
6
Views
281

### You have a typo. It is uint8_t not unit8_t.

You have a typo. It is uint8_t not unit8_t.
3. ## Thread: Final filter test failing

by hamster_nz
Replies
3
Views
201

### Just by eyeballing them I can tell that they are...

Just by eyeballing them I can tell that they are good. They start at "all zeros" and end at "all ones".

But will supply a table when I finish work (in about 9 hours or so).

by hamster_nz
Replies
2
Views
210

### For a given block of data, prior_key is ...

For a given block of data, prior_key is 0x00000001 for the first time the function is called, and from then on whatever was returned by this function the last time it was called.
5. ## Thread: Scaling integer values without FPNs

by hamster_nz
Replies
4
Views
192

### The usual way to scale an n-bit value into a...

The usual way to scale an n-bit value into a 2n-bit value is to multiply by 2^n+1.

e.g. from a 4-bit value to an 8-bit value is to multiply by 17.

Coding it is usually a shift-and-add:

...
6. ## Thread: Increment gone wrong

by hamster_nz
Replies
125
Views
5,100

### Here's 37 lines that does those 200 lines...

Here's 37 lines that does those 200 lines correctly. Note how everything is handled identically.

static const int32_t lut_code[19] = { 0, 1, 2, 3, 4, 5, 6, 7, 8,...
7. ## Thread: Increment gone wrong

by hamster_nz
Replies
125
Views
5,100

You still need to adjust the rest of your code accordingly too.

This change means that you will only need to add entries to your table in one place in your code, rather than handling those 16 and...
8. ## Thread: Increment gone wrong

by hamster_nz
Replies
125
Views
5,100

### I think you might end up with cleaner code if you...

I think you might end up with cleaner code if you realized that

ZLIB_IMPLIED implied_type_data =
{
/* get extra bits */
{
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0,...
9. ## Thread: Increment gone wrong

by hamster_nz
Replies
125
Views
5,100

### Looking at your output, the first table seems...

Looking at your output, the first table seems perfect.

The second one has literals that should not occur. 386? 404? 382?

code_symbols[ 0]: _tt = false, src = 138, lit = 283, use = ...
10. ## Thread: Dynamic memory allocation

by hamster_nz
Replies
20
Views
699

### It is very hard to track down if you mave a...

It is very hard to track down if you mave a memory leak in your code if it doesn't free all resources before exiting.

Also, usually tidying up before exiting can involve such things as writing...
11. ## Thread: Dynamic memory allocation

by hamster_nz
Replies
20
Views
699

### I strongly disagree with this advice....

I strongly disagree with this advice. "Maintaining a lost of allocated memory blocks" is exactly what malloc(), free(), realloc() and so on do on the inside, and usually do it in a far more nuanced...
12. ## Thread: Increment gone wrong

by hamster_nz
Replies
125
Views
5,100

### As requested Note that "x:y" is value x, with...

As requested

Note that "x:y" is value x, with repeat count y.

Image is properly decoded.

Last block = true
Compressed (dynamic dictionary)
13. ## Thread: Increment gone wrong

by hamster_nz
Replies
125
Views
5,100

### If you can supply me a test '.gz' data file you...

If you can supply me a test '.gz' data file you are using, I can send back what the correct codeword tables should be for that file.
14. ## Thread: Increment gone wrong

by hamster_nz
Replies
125
Views
5,100

### Here's the whole algorithm at a very high level:...

Here's the whole algorithm at a very high level:

1. Read in the three 5-bit values, hlit, hdist and hclen. Note that these need to have 257, 1 and 4 added to the 5-bit binary values that are read....
15. ## Thread: Increment gone wrong

by hamster_nz
Replies
125
Views
5,100

### I did try taking a look at your code, but without...

I did try taking a look at your code, but without comments to let me know what each step was doing I was unable to follow what was being attempted.
16. ## Thread: Finding a reference error by mathematical conditioning

by hamster_nz
Replies
5
Views
300

### It is a pretty common pattern that people use....

It is a pretty common pattern that people use. Not because it is particularly nice, but just because it fits on one line.
17. ## Thread: Finding a reference error by mathematical conditioning

by hamster_nz
Replies
5
Views
300

### '?' is the ternary operator. It is clamping x...

'?' is the ternary operator.

It is clamping x to between 0.0 an 0.35

Translated:

If x > 0.35 then
Use 0.35

Else If x < 0.0 then
18. ## Thread: Increment gone wrong

by hamster_nz
Replies
125
Views
5,100

### What you said there makes little sense to me. I...

What you said there makes little sense to me. I think you need to carefully consider the structure of the file and re-evaluate how you are processing it.

Map out what the possible inputs are (the...
19. ## Thread: Ternary operator unexpected result

by hamster_nz
Replies
6
Views
287

### What are the ASCII codes for 'a' and 'A'? And...

What are the ASCII codes for 'a' and 'A'?

And when you plug those values into the expression?
20. ## Thread: Increment gone wrong

by hamster_nz
Replies
125
Views
5,100

### Oh, and this may potentially give different...

Oh, and this may potentially give different results on big endian or little endian platforms:

ulong A;
uchar *a = (uchar*)&A;
21. ## Thread: Increment gone wrong

by hamster_nz
Replies
125
Views
5,100

### Are you sure that you have allowed for the edge...

Are you sure that you have allowed for the edge case where the filter attempts to address that that are to the left of, or above the visible image?

e.g. output_image[y][x] = output_image[y-1][x] +...
22. ## Thread: Software I2C - Not getting ACK from slave

by hamster_nz
Replies
4
Views
374

### High 7 bits are the device address, lowest bit...

High 7 bits are the device address, lowest bit indicates if it is a read or write transaction. So commands to device 0x55 will begin with either 0xAA or 0xAB.
23. ## Thread: Software I2C - Not getting ACK from slave

by hamster_nz
Replies
4
Views
374

### The trace looks good, and the address matches...

The trace looks good, and the address matches that in the datasheet so I guess it is something physical.

I did something similar to this a while ago, on TI 16-bit DAC. Got as far as reflowing a...
24. ## Thread: Increment gone wrong

by hamster_nz
Replies
125
Views
5,100

### I worked out what I don't like the feel of in...

I worked out what I don't like the feel of in default_allocator(), and that is that the user must specify the "had" amount correctly for it to work correctly.

Quite often you don't keep track of...
25. ## Thread: Increment gone wrong

by hamster_nz
Replies
125
Views
5,100

### The question you need to ask yourself is not "How...

The question you need to ask yourself is not "How did that bug get there?" but "How did this bad a bug go undetected for so long?".

That allocator must have never been used to grow a memory...
Results 1 to 25 of 302
Page 1 of 13 1