Merge pull request #341 from compnerd/llp64

dispatch: adjust for LLP64 environments
diff --git a/dispatch/once.h b/dispatch/once.h
index 37a4950..fbce4b1 100644
--- a/dispatch/once.h
+++ b/dispatch/once.h
@@ -38,7 +38,7 @@
  * Note: static and global variables default to zero.
  */
 DISPATCH_SWIFT3_UNAVAILABLE("Use lazily initialized globals instead")
-typedef long dispatch_once_t;
+typedef intptr_t dispatch_once_t;
 
 #if defined(__x86_64__) || defined(__i386__) || defined(__s390x__)
 #define DISPATCH_ONCE_INLINE_FASTPATH 1
diff --git a/src/source.c b/src/source.c
index 730e441..21ed64c 100644
--- a/src/source.c
+++ b/src/source.c
@@ -300,7 +300,7 @@
 
 DISPATCH_ALWAYS_INLINE
 static inline void
-_dispatch_source_handler_replace(dispatch_source_t ds, long kind,
+_dispatch_source_handler_replace(dispatch_source_t ds, uintptr_t kind,
 		dispatch_continuation_t dc)
 {
 	if (!dc->dc_func) {
@@ -321,14 +321,14 @@
 	dispatch_assert(dx_type(ds) == DISPATCH_SOURCE_KEVENT_TYPE);
 
 	dispatch_continuation_t dc = context;
-	long kind = (long)dc->dc_data;
+	void *kind = dc->dc_data;
 	dc->dc_data = NULL;
-	_dispatch_source_handler_replace(ds, kind, dc);
+	_dispatch_source_handler_replace(ds, (uintptr_t)kind, dc);
 }
 
 DISPATCH_NOINLINE
 static void
-_dispatch_source_set_handler(dispatch_source_t ds, long kind,
+_dispatch_source_set_handler(dispatch_source_t ds, uintptr_t kind,
 		dispatch_continuation_t dc)
 {
 	dispatch_assert(dx_type(ds) == DISPATCH_SOURCE_KEVENT_TYPE);