Profile cover photo
Profile photo
Howard C. Shaw III
1,125 followers -
Programmer, fanfic writer, continual reader, geek
Programmer, fanfic writer, continual reader, geek

1,125 followers
About
Posts

Post has attachment
Started late, day 4, finished with one day to go in spite of Super Mario Odyssey.
Add a comment...

Post has attachment
Sky being all dramatic.
Photo
Add a comment...

Post has attachment
When is Duff's Device not Duff's Device?

https://luciotato.svbtle.com/golangs-duffs-devices

Apparently the Golang sources have a bit of code that they call out at the top as being a Duff's device.

What is a Duff's device? https://en.wikipedia.org/wiki/Duff%27s_device

It is a very very specific piece of C coding designed to do in C what is otherwise difficult, which is to jump into the middle of an unrolled loop to handle the case when the number of times you need to loop is not a multiple of your unrolling.

That is, if your loop was adding one to X:

for (i=0; i < Y; ++i) {
X++;
}

an unrolled form might be akin to

for (i=0; i < Y/4; ++i) {
X++;
X++;
X++;
X++;
}

Duff's device is a tricky way of interleaving a switch statement and a loop together to mimic the Assembly pattern of simply jumping into the middle of the loop.

The comment at the start of one section in the Go code:
// A Duff's device for zeroing memory.
// The compiler jumps to computed addresses within
// this routine to zero chunks of memory.

Ehrm... no, that is not Duff's device, that is simply an assembly style unrolled loop plus computed jumping. The whole point of Duff's device was to cleverly handle the fact that he couldn't just do that. Go's code is just doing that.

Apparently in at least some circles, the term 'Duff's device' has grown and migrated from 'a clever workaround in C for doing assembly-style loop unrolling' to just 'loop unrolling,' sort of.

Here is Tom Duff's own description and a copy of his original post on the matter, making it clear that the actual device is the C trickery, and not the generic loop unrolling: https://www.lysator.liu.se/c/duffs-device.html
Add a comment...

Post has attachment
Wolf spider with her egg sac-the original fanny pack.
Photo
Add a comment...

Post has attachment
Photo
Add a comment...

Post has attachment
+Brook Drumm I took advantage of your last holiday sale to pick up a Printrbot Simple Metal built by your crew, to replace my original Kickstarter reprap-style Printrbot (put together by my brother and myself) which suffered from issues with the dual z-motors, but which printed fine for several years.

Got the delivery, pulled it out of the box, read the instructions on the website, followed them. Clipped one little zip-tie, loosened and retightened two little bolts. Installed Cura. Grabbed default settings file as recommended, grabbed suggested STL file for first print... hit print, waited... and it printed, no problems, no issues.

I don't think it was even an hour between opening the box, and seeing the first plastic laid down. Awesome job!

And right out of the box it was printing .2mm... best I could manage before was .3, and that was after slowly working it down from .5... So I took a chance, and tried a print at half that width. Printed just fine at .1mm, no tweaks, no testing and dozens of failures - just set the value to half what it started at, hit print, and it worked.

Watching it tap the bed and figure out not only the zero point, but the level of the bed itself, and lay down a first layer with no issues is amazing. Having a built-in spool holder is also really sweet - I never did get my kit-Printrbot to the point where I felt safe walking away. The new Simple Metal, I have walked away on most of these prints, and no problems yet. My only two straight up failed prints came when I forgot to lay down my blue tape before starting.

I'm really happy to see that my little investment way back then helped launch not only that printer, but eventually lead to this little beauty.
PhotoPhotoPhotoVideo
Photo
6/10/17
7 Photos - View album
Add a comment...

Post has attachment
Dramatic sky on the way home today.
Photo
Add a comment...

Post has attachment
Wildflowers at home in the garden. Still wild?
Photo
Add a comment...

Post has attachment
Insects like their veggies and fruits.
Photo
Photo
5/20/17
2 Photos - View album
Add a comment...

Post has attachment
Summer in spider city
PhotoPhotoPhotoPhoto
5/16/17
4 Photos - View album
Add a comment...
Wait while more posts are being loaded