mirror of
				https://github.com/janet-lang/janet
				synced 2025-10-31 07:33:01 +00:00 
			
		
		
		
	Conditionally compile marshal_ptr code.
This commit is contained in:
		| @@ -364,11 +364,11 @@ void janet_marshal_int(JanetMarshalContext *ctx, int32_t value) { | |||||||
|  |  | ||||||
| /* Only use in unsafe - don't marshal pointers otherwise */ | /* Only use in unsafe - don't marshal pointers otherwise */ | ||||||
| void janet_marshal_ptr(JanetMarshalContext *ctx, const void *ptr) { | void janet_marshal_ptr(JanetMarshalContext *ctx, const void *ptr) { | ||||||
|     if (sizeof(ptr) == sizeof(int64_t)) { | #ifdef JANET_32 | ||||||
|         janet_marshal_int64(ctx, (intptr_t) ptr); |  | ||||||
|     } else { |  | ||||||
|     janet_marshal_int(ctx, (intptr_t) ptr); |     janet_marshal_int(ctx, (intptr_t) ptr); | ||||||
|     } | #else | ||||||
|  |     janet_marshal_int64(ctx, (intptr_t) ptr); | ||||||
|  | #endif | ||||||
| } | } | ||||||
|  |  | ||||||
| void janet_marshal_byte(JanetMarshalContext *ctx, uint8_t value) { | void janet_marshal_byte(JanetMarshalContext *ctx, uint8_t value) { | ||||||
| @@ -1176,11 +1176,11 @@ int64_t janet_unmarshal_int64(JanetMarshalContext *ctx) { | |||||||
|  |  | ||||||
| void *janet_unmarshal_ptr(JanetMarshalContext *ctx) { | void *janet_unmarshal_ptr(JanetMarshalContext *ctx) { | ||||||
|     UnmarshalState *st = (UnmarshalState *)(ctx->u_state); |     UnmarshalState *st = (UnmarshalState *)(ctx->u_state); | ||||||
|     if (sizeof(int64_t) == sizeof(void *)) { | #ifdef JANET_32 | ||||||
|         return (void *) ((intptr_t) read64(st, &(ctx->data))); |  | ||||||
|     } else { |  | ||||||
|     return (void *) ((intptr_t) readint(st, &(ctx->data))); |     return (void *) ((intptr_t) readint(st, &(ctx->data))); | ||||||
|     } | #else | ||||||
|  |     return (void *) ((intptr_t) read64(st, &(ctx->data))); | ||||||
|  | #endif | ||||||
| } | } | ||||||
|  |  | ||||||
| uint8_t janet_unmarshal_byte(JanetMarshalContext *ctx) { | uint8_t janet_unmarshal_byte(JanetMarshalContext *ctx) { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Calvin Rose
					Calvin Rose