public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] opensm - use uintptr_t instead of unsigned long
@ 2009-10-08 17:12 Stan C. Smith
       [not found] ` <B4D2EF981C584307AA9204669ECE3F31-Zpru7NauK7drdx17CPfAsdBPR1lH4CV8@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Stan C. Smith @ 2009-10-08 17:12 UTC (permalink / raw)
  To: 'Sasha Khapyorsky'; +Cc: ofw, 'linux-rdma'


 sizeof unsigned long != sizeof void * in Windows world.

If you can live with uintptr_t for 
  __WORDSIZE == 32 being 'unsigned int' (see stdint.h)
  __WORDSIZE == 64 uintptr_t is 'unsigned long int'
then we could skip the ifdef __GNUC__ and just replace 'unsigned long' with uintptr_t.

Stan.

Signed-off-by: stan smith <stan.smith@intel.com>

diff --git a/opensm/include/opensm/st.h b/opensm/include/opensm/st.h
index 30cc308..dd7eacc 100644
--- a/opensm/include/opensm/st.h
+++ b/opensm/include/opensm/st.h
@@ -49,7 +49,11 @@
 #endif				/* __cplusplus */
 
 BEGIN_C_DECLS
+#ifdef __GNUC__
 #define st_ptr_t unsigned long
+#else
+#define st_ptr_t uintptr_t
+#endif
 typedef st_ptr_t st_data_t;
 
 #define ST_DATA_T_DEFINED

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] opensm - use uintptr_t instead of unsigned long
       [not found] ` <B4D2EF981C584307AA9204669ECE3F31-Zpru7NauK7drdx17CPfAsdBPR1lH4CV8@public.gmane.org>
@ 2009-10-08 17:55   ` Jason Gunthorpe
  0 siblings, 0 replies; 3+ messages in thread
From: Jason Gunthorpe @ 2009-10-08 17:55 UTC (permalink / raw)
  To: Stan C. Smith
  Cc: 'Sasha Khapyorsky', ofw-ZwoEplunGu1OwGhvXhtEPSCwEArCW2h5,
	'linux-rdma'

On Thu, Oct 08, 2009 at 10:12:03AM -0700, Stan C. Smith wrote:

> If you can live with uintptr_t for 
>   __WORDSIZE == 32 being 'unsigned int' (see stdint.h)
>   __WORDSIZE == 64 uintptr_t is 'unsigned long int'
> then we could skip the ifdef __GNUC__ and just replace 'unsigned long' with uintptr_t.

uinptr_t is the appropriate ISO C99 type for this, every platform
should use it.

Non-standard names like st_ptr_t should just be eradicated.

Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] opensm - use uintptr_t instead of unsigned long
@ 2009-10-12 16:23 Stan C. Smith
  0 siblings, 0 replies; 3+ messages in thread
From: Stan C. Smith @ 2009-10-12 16:23 UTC (permalink / raw)
  To: 'Sasha Khapyorsky'; +Cc: ofw, 'linux-rdma'


 sizeof unsigned long != sizeof void * in Windows world
Use correct type.

Signed-off-by: stan smith <stan.smith@intel.com>

diff --git a/opensm/include/opensm/st.h b/opensm/include/opensm/st.h
index 30cc308..fc558c8 100644
--- a/opensm/include/opensm/st.h
+++ b/opensm/include/opensm/st.h
@@ -49,7 +49,7 @@
 #endif				/* __cplusplus */
 
 BEGIN_C_DECLS
-#define st_ptr_t unsigned long
+#define st_ptr_t uintptr_t
 typedef st_ptr_t st_data_t;
 
 #define ST_DATA_T_DEFINED

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-10-12 16:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-08 17:12 [PATCH] opensm - use uintptr_t instead of unsigned long Stan C. Smith
     [not found] ` <B4D2EF981C584307AA9204669ECE3F31-Zpru7NauK7drdx17CPfAsdBPR1lH4CV8@public.gmane.org>
2009-10-08 17:55   ` Jason Gunthorpe
  -- strict thread matches above, loose matches on Subject: below --
2009-10-12 16:23 Stan C. Smith

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox