git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] fix warning from pack-objects.c

From
Luck, Tony <tony.luck@intel.com>
Date
Feb 23, 2006, 22:42 UTC
Message-ID
<200602232242.k1NMgdAJ018406@agluck-lia64.sc.intel.com>
When compiling on ia64 I get this warning (from gcc 3.4.3):

gcc -o pack-objects.o -c -g -O2 -Wall -DSHA1_HEADER='<openssl/sha.h>' pack-objects.c pack-objects.c: In function `pack_revindex_ix': pack-objects.c:94: warning: cast from pointer to integer of different size

A double cast (first to long, then to int) shuts gcc up, but is there a better way?

Signed-off-by: Tony Luck <tony.luck@intel.com>
---
diff --git a/pack-objects.c b/pack-objects.c
index 8f352aa..c985fab 100644
--- a/pack-objects.c
+++ b/pack-objects.c
@@ -91,7 +91,7 @@ static int reused_delta = 0;
 
 static int pack_revindex_ix(struct packed_git *p)
 {
-	unsigned int ui = (unsigned int) p;
+	unsigned int ui = (unsigned int)(long)p;
 	int i;
 
 	ui = ui ^ (ui >> 16); /* defeat structure alignment */
Next: Andreas Ericsson
Message 1 of 2 in “fix warning from pack-objects.c”
  1. fix warning from pack-objects.cLuck, Tony, Feb 23, 2006
  2. Andreas EricssonFeb 23, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.