Re: [PATCH] SQUASHME: blkmapd: fix pretty_sig short sig endianess agnosticity

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Benny Halevy wrote:

  Like this?
  
  diff --git a/utils/blkmapd/device-process.c b/utils/blkmapd/device-process.c
  index ea8b8ec..0d8705f 100644
  --- a/utils/blkmapd/device-process.c
  +++ b/utils/blkmapd/device-process.c
  @@ -58,10 +58,8 @@ static char *pretty_sig(char *sig, uint32_t siglen)
   		int i;
   
   		sigval = 0;
  -		for (i = 0; i < siglen; i++) {
  -			sigval <<= 8;
  -			sigval += ((unsigned char *)sig)[i];
  -		}
  +		for (i = 0; i < siglen; i++)
  +			sigval |= ((unsigned char *)sig)[i] << (i * 8);
   		sprintf(rs, "0x%0llx", sigval);
   	} else {
   		if (siglen > sizeof rs - 4) {

That works for me, yes.
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux