Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: m-labs/flickernoise
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 86fef88
Choose a base ref
...
head repository: m-labs/flickernoise
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 2d66a34
Choose a head ref
  • 2 commits
  • 1 file changed
  • 2 contributors

Commits on Nov 1, 2011

  1. input.c: remove unnecessary casts

    This patch to Flickernoise removes a number of casts that serve no
    purpose and - in the case of handle_midi_msg - clutter code that
    needs some more fixing.
    
    I didn't run the code but I checked that the assembler output is
    equivalent. It's not identical because the line numbers of four
    asserts changed.
    
    There is a bit more redundancy in the form of
    
      ... | (foo << bar) | ...
    
    which could be written as
    
      ... | foo << bar | ...
    
    I didn't touch these since some people prefer the parentheses as
    part of their coding style. If you want such things gone as well,
    please let me know.
    
    - Werner
    wpwrak authored and Sebastien Bourdeauducq committed Nov 1, 2011
    Copy the full SHA
    5447460 View commit details
  2. Merge branch 'master' of github.com:milkymist/flickernoise

    Sebastien Bourdeauducq committed Nov 1, 2011
    Copy the full SHA
    2d66a34 View commit details
Showing with 5 additions and 8 deletions.
  1. +5 −8 src/input.c
13 changes: 5 additions & 8 deletions src/input.c
Original file line number Diff line number Diff line change
@@ -67,10 +67,7 @@ static int handle_mouse_event(mtk_event *e, unsigned char *msg)
unsigned int mstate;
int n;

mstate = ((unsigned int)msg[0] << 24)
|((unsigned int)msg[1] << 16)
|((unsigned int)msg[2] << 8)
|((unsigned int)msg[3]);
mstate = (msg[0] << 24) | (msg[1] << 16) | (msg[2] << 8) | msg[3];

n = 0;
/* left mouse button pressed */
@@ -237,19 +234,19 @@ static int handle_ir_event(mtk_event *e, unsigned char *msg)

static int handle_midi_msg(mtk_event *e, unsigned char *msg)
{
e->press.code = ((unsigned int)(msg[0]) & 0x0f) << 16; /* set channel */
e->press.code = (msg[0] & 0x0f) << 16; /* set channel */
switch(msg[0] & 0xf0) {
case 0x90: /* Note On */
e->type = EVENT_TYPE_MIDI_NOTEON;
e->press.code |= (unsigned int)msg[1];
e->press.code |= msg[1];
return 1;
case 0xb0: /* Controller */
e->type = EVENT_TYPE_MIDI_CONTROLLER;
e->press.code |= ((unsigned int)msg[1] << 8) | (unsigned int)msg[2];
e->press.code |= (msg[1] << 8) | msg[2];
return 1;
case 0xe0: /* Pitch */
e->type = EVENT_TYPE_MIDI_PITCH;
e->press.code |= (unsigned int)msg[2];
e->press.code |= msg[2];
return 1;
default:
return 0;