aboutsummaryrefslogtreecommitdiffstats
path: root/Projects/MIDIToneGenerator/MIDIToneGenerator.c
diff options
context:
space:
mode:
authorDean Camera <dean@fourwalledcubicle.com>2011-04-13 06:12:52 +0000
committerDean Camera <dean@fourwalledcubicle.com>2011-04-13 06:12:52 +0000
commite0852408de92eada94b242cf84b007dc4f188467 (patch)
treeb58ea4dab5bffecccf932422804d2e378e87b1fa /Projects/MIDIToneGenerator/MIDIToneGenerator.c
parent4b1f6cac75a86874d2a15e1893cfb258b2397fb5 (diff)
downloadlufa-e0852408de92eada94b242cf84b007dc4f188467.tar.gz
lufa-e0852408de92eada94b242cf84b007dc4f188467.tar.bz2
lufa-e0852408de92eada94b242cf84b007dc4f188467.zip
Replace cast-as-char* byte access of multibyte variables with proper shifts and masks to preserve endianness across different architectures.
Diffstat (limited to 'Projects/MIDIToneGenerator/MIDIToneGenerator.c')
-rw-r--r--Projects/MIDIToneGenerator/MIDIToneGenerator.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/Projects/MIDIToneGenerator/MIDIToneGenerator.c b/Projects/MIDIToneGenerator/MIDIToneGenerator.c
index a4e2764c0..e1008a7d3 100644
--- a/Projects/MIDIToneGenerator/MIDIToneGenerator.c
+++ b/Projects/MIDIToneGenerator/MIDIToneGenerator.c
@@ -166,7 +166,7 @@ ISR(TIMER0_COMPA_vect, ISR_BLOCK)
if (NoteData[i].Pitch)
{
/* Use the top 8 bits of the table position as the sample table index */
- uint8_t TableIndex = ((uint8_t*)&NoteData[i].TablePosition)[3];
+ uint8_t TableIndex = (NoteData[i].TablePosition >> 24);
/* Add the new tone sample to the accumulator and increment the table position */
MixedSample += SineTable[TableIndex];