[pisa-src] Re: r2524 - trunk/tools/dhcp/mac2ip.c

  • From: Christoph Viethen <christoph.viethen@xxxxxxxxxxxxxx>
  • To: pisa-src@xxxxxxxxxxxxx
  • Date: Fri, 08 Apr 2011 10:23:36 +0200

Hi,

on Apr 8, 2011, at 9:51 AM, Christof Mroz wrote:

> On Fri, 08 Apr 2011 02:31:49 +0200, Christoph Viethen 
> <christoph.viethen@xxxxxxxxxxxxxx> wrote:
> 
>> +    uint32_t lower_bounds_value;
>> +    uint32_t upper_bounds_value;
>> +    uint64_t num_bounds_ips;
>> +    uint32_t old_ip_value, new_ip_value;
> 
> These can be const.

Ummm, alright, I may not be quite awake yet. Can they? I'm writing to them, 
right? (I got this funny feeling I may be asking *really* stupid questions 
here. Hmmm, will notice soon, I guess.)

>> +    upper_bounds_value = ((upper_bound->x[0] * 256 + upper_bound->x[1]) * 
>> 256 + upper_bound->x[2]) * 256 + upper_bound->x[3];
>> +    num_bounds_ips     = upper_bounds_value - lower_bounds_value + 1;
>> +
>> +    /* convert the input IP into a numerical value */
>> +    old_ip_value = ((ip->x[0] * 256 + ip->x[1]) * 256 + ip->x[2]) * 256 + 
>> ip->x[3];
> 
> Bit shifts are probably more readable.

Haha, I know what you mean. :-)

Actually, wait for one of my next checkins, because quite a bit of this will 
dissolve into little clouds of ... nothing once I'll begin to use standard 
stuff like htonl() on standard data types.

> <mac2ip.py>

Thanks, that looks interesting!

Cheers,

  Christoph

-- 
 christoph.viethen@xxxxxxxxxxxxxx

-- 
This is the pisa developer mailing list. Please also subscribe to the main pisa 
list at:
//www.freelists.org/list/pisa

Other related posts: