diff options
Diffstat (limited to 'src/fd.hpp')
-rw-r--r-- | src/fd.hpp | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -30,17 +30,26 @@ namespace xs { + #ifdef XS_HAVE_WINDOWS #if defined _MSC_VER &&_MSC_VER <= 1400 typedef UINT_PTR fd_t; enum {retired_fd = (fd_t)(~0)}; + inline void *fdtoptr (fd_t fd_) {return (void*) fd_;} + inline fd_t ptrtofd (void *ptr_) {return (fd_t) ptr_;} #else typedef SOCKET fd_t; enum {retired_fd = INVALID_SOCKET}; + inline void *fdtoptr (fd_t fd_) {return (void*) fd_;} + inline fd_t ptrtofd (void *ptr_) {return (fd_t) ptr_;} #endif #else typedef int fd_t; enum {retired_fd = -1}; + inline void *fdtoptr (fd_t fd_) {return (void*) fd_;} + inline fd_t ptrtofd (void *ptr_) {return (int) ((char*) ptr_ - (char*) 0);} #endif + } + #endif |