Warning C4267
Jastonite opened this issue · 0 comments
Jastonite commented
This is a minor issue, but I use the Microsoft VC++ compiler, and I have have the warning level set to 4 (which includes 4xxx warnings). This line (file: as_jit.cpp line: 3800) issues a C4267 warning: "conversion from 'size_t' to 'unsigned int', possible loss of data.
#ifdef _MSC_VER
unsigned offset = ((size_t)func->func) >> 2;
offset *= sizeof(void*);
as<void*>(pax) += offset;
as<void*>(pax) = as<void*>(*pax);
#endif
To me it looks like the conversion is safe in this context, but it would be nice to address the warning. I am currently using this patch:
#ifdef _MSC_VER
unsigned offset = (unsigned)(((size_t)func->func) >> 2);
offset *= sizeof(void*);
as<void*>(pax) += offset;
as<void*>(pax) = as<void*>(*pax);
#endif