Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 27 Jul 2006 09:27:16 -0700
From:      Nate Lawson <nate@root.org>
To:        Pawel Jakub Dawidek <pjd@FreeBSD.org>
Cc:        cvs-src@FreeBSD.org, src-committers@FreeBSD.org, cvs-all@FreeBSD.org
Subject:   Re: cvs commit: src/sys/crypto/via padlock.h
Message-ID:  <44C8E964.1060106@root.org>
In-Reply-To: <20060725190716.C73E016A595@hub.freebsd.org>
References:  <20060725190716.C73E016A595@hub.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Pawel Jakub Dawidek wrote:
> pjd         2006-07-25 19:06:54 UTC
> 
>   FreeBSD src repository
> 
>   Modified files:
>     sys/crypto/via       padlock.h 
>   Log:
>   Modify PADLOCK_ALIGN() macro, so when the given address is already 16 bytes
>   aligned, it will be used directly, not 'address + 16'.
>   
>   Revision  Changes    Path
>   1.3       +1 -1      src/sys/crypto/via/padlock.h
> 
> 
> Index: src/sys/crypto/via/padlock.h
> diff -u src/sys/crypto/via/padlock.h:1.2 src/sys/crypto/via/padlock.h:1.3
> --- src/sys/crypto/via/padlock.h:1.2	Tue Jul 25 19:04:26 2006
> +++ src/sys/crypto/via/padlock.h	Tue Jul 25 19:06:54 2006
> @@ -72,7 +72,7 @@
>  	TAILQ_ENTRY(padlock_session) ses_next;
>  };
>  
> -#define PADLOCK_ALIGN(p)	(void *)((char *)(p) - ((uintptr_t)(p) % 16) + 16)
> +#define PADLOCK_ALIGN(p)	(void *)((uintptr_t)(p) - (((uintptr_t)(p) - 1) % 16) + 15)
>  
>  int	padlock_cipher_setup(struct padlock_session *ses,
>  	    struct cryptoini *encini);

I think you want roundup2() since 16 is a power of 2, see sys/param.h

-- 
Nate




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?44C8E964.1060106>