On Wed, May 19, 2010 at 11:52 AM, Smith, Stan <[email protected]> wrote: > Hal Rosenstock wrote: >> Hi Fab, >> >> On Wed, May 19, 2010 at 1:23 AM, Fab Tillier <[email protected]> >> wrote: >>> Hi Hal, >>> >>> Hal Rosenstock wrote on Tue, 18 May 2010 at 19:22:37 >>> >>>>> AL_INLINE ib_net16_t AL_API >>>>> ib_get_attr_offset( >>>>> IN const uint32_t attr_size ) { >>>>> if( attr_size & 0x07 ) >>>>> return( cl_hton16( (uint16_t)(attr_size >> 3) + 1 ) >>>>> ); else return( cl_hton16( >>>>> (uint16_t)(attr_size >> 3) ) ); } >>>>> >>>>> Linux >>>>> >>>>> static inline ib_net16_t AL_API >>>>> ib_get_attr_offset(const uint32_t attr_size ) >>>>> { >>>>> return( cl_hton16( (uint16_t)(attr_size >> 3) ) ); >>>>> } >>>> >>>> Why does Windows have the if clause in ib_get_attr_off (and not >>>> match the "Linux" version) ? >>> >>> So that the returned offset is not rounded down incorrect. Say the >>> attribute size is not a multiple of 8, the >> 3 would return a value >>> 1 less than required. >>> >>> Not sure how the Linux code works properly, unless the structure >>> sizes somehow get rounded to a multiple of 8. >> >> The record structs which are not modulo 8 bytes are explictly padded >> out (e.g NodeRecord, LinkRecord, SMInfoRecord, InformInfoRecord). If >> this is followed in the struct definitions, then the if clause is >> never used. >> >> -- Hal >> >>> -Fab > > A little insurance never hurts;
Just a little extra unneeded/unused code. This if clause was removed quite some time ago as I didn't see any log history to it so it prior to git (when OpenSM was still in svn). > although it can mask aligment problems. Right. -- Hal > Perhaps the 'adjustment' should be turned into a nastygram? > > stan. > _______________________________________________ ofw mailing list [email protected] http://lists.openfabrics.org/cgi-bin/mailman/listinfo/ofw
