tftp.c (rx_callback): simplify expressions containing unnecessary casts
authorWerner Almesberger <werner@almesberger.net>
Tue, 16 Apr 2013 16:55:22 +0000 (13:55 -0300)
committerSebastien Bourdeauducq <sebastien@milkymist.org>
Tue, 16 Apr 2013 17:23:12 +0000 (19:23 +0200)
software/bios/tftp.c

index 6d796de1a638a68494a569dd61fc274a3c0ef2cd..29e266579695a490cc239412e79260ca9bf5f8b8 100644 (file)
@@ -55,8 +55,8 @@ static void rx_callback(unsigned int src_ip, unsigned short src_port,
        
        if(length < 4) return;
        if(dst_port != PORT_IN) return;
-       opcode = ((unsigned short)(data[0]) << 8)|((unsigned short)(data[1]));
-       block = ((unsigned short)(data[2]) << 8)|((unsigned short)(data[3]));
+       opcode = data[0] << 8 | data[1];
+       block = data[2] << 8 | data[3];
        if(block < 1) return;
        if(opcode == TFTP_DATA) { /* Data */
                length -= 4;