Date: Fri, 10 Dec 2021 17:10:25 +0100 (CET) From: Frank Lichtenheld Message-ID: <349475353.849108.1639152625293@...2642...> In-Reply-To: <20211207170211.3275837-6-arne@...1227...> References: <20211207170211.3275837-1-arne@...1227...> <20211207170211.3275837-6-arne@...1227...> MIME-Version: 1.0 Subject: Re: [Openvpn-devel] [PATCH 05/21] Document frame related function and variables a bit more List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit To: Arne Schwabe , openvpn-devel@lists.sourceforge.net Acked-by: Frank Lichtenheld > Arne Schwabe hat am 07.12.2021 18:01 geschrieben: > @@ -246,6 +262,8 @@ static inline int > frame_headroom(const struct frame *f) > { > const int offset = FRAME_HEADROOM_BASE(f); > + /* These two lines just pad offset to next multiple of PAYLOAD_ALIGN in > + * a complicated and confusing way */ > const int delta = ((PAYLOAD_ALIGN << 24) - offset) & (PAYLOAD_ALIGN - 1); The 24 is completely arbitrary, right? As long as the result is always bigger than offset, you can use any other number. I wonder whether it might be possible to replace it with something slightly less confusing (IMHO, anyway), like delta = (PAYLOAD_ALIGN - (offset % PAYLOAD_ALIGN)) & (PAYLOAD_ALIGN - 1); But my C-foo is not strong enough to judge potential corner cases. Regards, Frank -- Frank Lichtenheld