In last week’s Lesson, I waxed on about how a text message can be concealed in a delightful manner, making it not look like a text message at all. To get to that point, you must write some code that translates plain text into the values desired.
Continue reading
Author Archives: dgookin
Primitive Math – Solution
The solution to this month’s Exercise involves two things. First, knowing how to shift bits and second how to carefully enclose operators in parentheses to get the macros to behave.
Continue reading
Cryptic Text Encoding
Typing in sample code was all the rage back when I first learned assembly language. The programs were short. Most of them I could understand based on my limited knowledge, but I still enjoyed seeing the result and wondering how they did it. Hopefully, I’d learn something.
Continue reading
Primitive Math
In a recent Lesson, I explored upon the idea of creating binary math macros. This technique was popular in Assembly language programs where the processor lacks high order math functions, including basic multiplication and division. In C you can code one-line macros that mimic Assembly’s bit-shifting behavior required to multiply values.
Continue reading
Long Lines
If I were well-versed in a handful of programming languages, I’m sure I’d find one better than C for examining line lengths in a text file. Perhaps Perl could do the trick? or even the shell language? Regardless, I know C.
Continue reading
Find the Vowel
I admit that sometimes I need to see someone else’s code before a formerly obscure function becomes useful to me. A case in point is the strchr() function, which I rarely use.
Continue reading
Macros Galore!
In last week’s Lesson, I demonstrated how macros can save time, effectively replacing one-line functions in your code. One place I’ve used macros in my own code is when performing binary math operations.
Continue reading
Interesting Numbers – Solution
Interesting numbers have a mathematical property that makes them handy in a certain way. For programming, these numbers present useful binary patterns that may be obvious in hexadecimal but meaningless in decimal. For non-programmers and non-mathematicians, interesting numbers offer visual patterns that most likely have no useful application beyond their look.
Continue reading
Macros or Functions
In C, a macro is a preprocessor directive that creates a shortcut, often a one-line expression to be inserted elsewhere in the code. Macros can make code more readable, but they can have a negative effect when implemented in a clumsy manner.
Continue reading
Interesting Numbers
Long ago, I worked with a programmer who had a habit of referring to certain values as “interesting.” What was an interesting number to him? 43,690. Yeah, it seems dull, but in hex it’s 0xAAAA and in binary it’s 1010101010101010. Interesting.
Continue reading