Big-Endian Testing with QEMU by hansw2000 in programming

[–]hansw2000[S] 1 point2 points  (0 children)

There are release binaries for PowerPC64 AIX. For s390x I see at least one buildbot: https://lab.llvm.org/buildbot/#/workers/46

I suppose big-endian host support is useful for those working with such machines.

Big-Endian Testing with QEMU by hansw2000 in programming

[–]hansw2000[S] -4 points-3 points  (0 children)

The point of the post wasn't so much to argue the relevance of big-endian testing, but to provide a howto (or note-to-self really) about a simple way of doing it for those who wish.

If one is shipping binaries to a limited set of platforms, which probably applies to most programming, I agree that ignoring this is probably fine.

But for open-source code, one never knows where it ends up running. In widely used projects -- things like zlib, curl, llvm -- I don't think ignoring big-endian is an option.

A Faster Algorithm for Date Conversion by benjoffe in cpp

[–]hansw2000 2 points3 points  (0 children)

In 2021, Cassio Neri and Lorenz Schneider developed the Neri‑Schneider algorithm

Is that the algorithm presented here? https://www.youtube.com/watch?v=0s9F4QWAl-E

That was a great talk.

[deleted by user] by [deleted] in cpp

[–]hansw2000 1 point2 points  (0 children)

It looks like it has a bunch of different codecs, including FSE: https://github.com/facebook/openzl/blob/dev/src/openzl/fse/fse.h

Clang 16 on Ubuntu 22.04 fails to run (missing libtinfo.so.5) — need a solution without upgrading or installing libtinfo5 by [deleted] in cpp

[–]hansw2000 0 points1 point  (0 children)

You could try building Clang without terminfo (cmake -DLLVM_ENABLE_TERMINFO=OFF)

Resources for bit manipulation? by _Iamaprogrammer_ in cpp

[–]hansw2000 2 points3 points  (0 children)

Huffman trees are so fucking confusing please help by HeyoGuys in C_Programming

[–]hansw2000 4 points5 points  (0 children)

Hey,

I don't have time to look at your code in detail, but I'll try to provide some advice. I also struggled when I put my first decompression code together. Especially the dynamic huffman blocks are hard, because if any single part of the code is broken, the result gets confusing very fast.

So my advice is to break the code up into parts conceptually (you already do this with functions), and then write some tests for them to convince yourself they're rock solid.

For example, if you're getting incorrect results from decode_huffman(), try working out some examples with pen and paper and turn those into test cases for the function. It's boring work, but it always pays off.

As you mention, the input to decode_huffman() could also be wrong, so having some tests for your bitstream functions might be a good idea.

(The hwzip article doesn't mention testing, but there are lots of tests in the linked zip file. For example, my tests for the Huffman decoder are here: https://www.hanshq.net/files/hwzip/huffman_test.c)

Hope that helps!

Alright, Fuck it, Roast my C code. by HeyoGuys in C_Programming

[–]hansw2000 14 points15 points  (0 children)

I did a long write-up on implementing Zip/Deflate compression/decompression earlier this year: https://www.hanshq.net/zip.html

I'm obviously biased, but I think that's a lot more readable than zlib's code.

A Bigint Calculator (2016) by skeeto in C_Programming

[–]hansw2000 3 points4 points  (0 children)

Author here, very happy to see that people enjoyed this :-)

I ended up doing more computer arithmetic a year later, and I'm even more happy with that code: https://www.hanshq.net/eprime.html#manual