From 995d9a599905dfbb059b7c5d3ba8b0af240e42d5 Mon Sep 17 00:00:00 2001 From: alpine9000 Date: Wed, 16 Mar 2016 20:59:49 +1100 Subject: [PATCH] Make C example more C, less asm --- 021.calling_c/c_code.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/021.calling_c/c_code.c b/021.calling_c/c_code.c index 8b42c58..365aaff 100644 --- a/021.calling_c/c_code.c +++ b/021.calling_c/c_code.c @@ -1,6 +1,9 @@ typedef union { unsigned char* ptr; - unsigned short word[2]; + struct { + unsigned short hi; + unsigned short lo; + } words; } word_extract_t; void @@ -12,8 +15,8 @@ PokeBitplanePointers(unsigned short* copper, unsigned char* bitplanes, unsigned for (i = 0; i < numBitplanes; i++) { word_extract_t extract; extract.ptr = bitplanes; - *(copper+1) = extract.word[1]; - *(copper+3) = extract.word[0]; + *(copper+1) = extract.words.lo; + *(copper+3) = extract.words.hi; bitplanes += screenWidthBytes; copper += 4; }