notes: make GET_NIBBLE macro more robust
Put parentheses around sha1. Otherwise it could fail for something
like
    GET_NIBBLE(n, (unsigned char *)data);
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
			
			
This commit is contained in:
		
				
					committed by
					
						
						Junio C Hamano
					
				
			
			
				
	
			
			
			
						parent
						
							edc74bc7f0
						
					
				
				
					commit
					65eb8e0ca7
				
			
							
								
								
									
										2
									
								
								notes.c
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								notes.c
									
									
									
									
									
								
							@ -64,7 +64,7 @@ struct non_note {
 | 
				
			|||||||
#define CLR_PTR_TYPE(ptr)       ((void *) ((uintptr_t) (ptr) & ~3))
 | 
					#define CLR_PTR_TYPE(ptr)       ((void *) ((uintptr_t) (ptr) & ~3))
 | 
				
			||||||
#define SET_PTR_TYPE(ptr, type) ((void *) ((uintptr_t) (ptr) | (type)))
 | 
					#define SET_PTR_TYPE(ptr, type) ((void *) ((uintptr_t) (ptr) | (type)))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define GET_NIBBLE(n, sha1) (((sha1[(n) >> 1]) >> ((~(n) & 0x01) << 2)) & 0x0f)
 | 
					#define GET_NIBBLE(n, sha1) ((((sha1)[(n) >> 1]) >> ((~(n) & 0x01) << 2)) & 0x0f)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define KEY_INDEX (GIT_SHA1_RAWSZ - 1)
 | 
					#define KEY_INDEX (GIT_SHA1_RAWSZ - 1)
 | 
				
			||||||
#define FANOUT_PATH_SEPARATORS ((GIT_SHA1_HEXSZ / 2) - 1)
 | 
					#define FANOUT_PATH_SEPARATORS ((GIT_SHA1_HEXSZ / 2) - 1)
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user