Re: [PATCH 01/41] cache: add a function to read an object ID from a buffer
- From
Duy Nguyen <pclouds@gmail.com>
- Date
- May 1, 2018, 09:36 UTC
- Message-ID
- <20180501093603.GA15820@duynguyen.home>
- In-Reply-To
- <20180423233951.276447-2-sandals@crustytoothpaste.net>
On Mon, Apr 23, 2018 at 11:39:11PM +0000, brian m. carlson wrote:
Show 11 quoted lines
> diff --git a/cache.h b/cache.h
> index bbaf5c349a..4bca177cf3 100644
> --- a/cache.h
> +++ b/cache.h
> @@ -1008,6 +1008,11 @@ static inline void oidclr(struct object_id *oid)
> memset(oid->hash, 0, GIT_MAX_RAWSZ);
> }
>
> +static inline void oidread(struct object_id *oid, const unsigned char *hash)
> +{
> + memcpy(oid->hash, hash, the_hash_algo->rawsz);If performance is a concern, should we go with GIT_MAX_RAWSZ instead of the_hash_algo->rawsz which gives the compiler some more to bypass actual memcpy function and generate copy code directly?
If it is not a performance problem, should we avoid inline and move the implementation somewhere?
> +} > + >