case GLSL_TYPE_BOOL:
dst[didx].f = src[sidx].i ? 1.0f : 0.0f;
break;
- case GLSL_TYPE_DOUBLE:
- dst[didx].f = *(double *)&src[sidx].f;
+ case GLSL_TYPE_DOUBLE: {
+ double tmp;
+ memcpy(&tmp, &src[sidx].f, sizeof(tmp));
+ dst[didx].f = tmp;
break;
+ }
default:
assert(!"Should not get here.");
break;
break;
case GLSL_TYPE_DOUBLE:
switch (uni->type->base_type) {
- case GLSL_TYPE_UINT:
- *(double *)&dst[didx].f = (double) src[sidx].u;
+ case GLSL_TYPE_UINT: {
+ double tmp = src[sidx].u;
+ memcpy(&dst[didx].f, &tmp, sizeof(tmp));
break;
+ }
case GLSL_TYPE_INT:
case GLSL_TYPE_SAMPLER:
- case GLSL_TYPE_IMAGE:
- *(double *)&dst[didx].f = (double) src[sidx].i;
+ case GLSL_TYPE_IMAGE: {
+ double tmp = src[sidx].i;
+ memcpy(&dst[didx].f, &tmp, sizeof(tmp));
break;
- case GLSL_TYPE_BOOL:
- *(double *)&dst[didx].f = src[sidx].i ? 1.0f : 0.0f;
+ }
+ case GLSL_TYPE_BOOL: {
+ double tmp = src[sidx].i ? 1.0 : 0.0;
+ memcpy(&dst[didx].f, &tmp, sizeof(tmp));
break;
- case GLSL_TYPE_FLOAT:
- *(double *)&dst[didx].f = (double) src[sidx].f;
+ }
+ case GLSL_TYPE_FLOAT: {
+ double tmp = src[sidx].f;
+ memcpy(&dst[didx].f, &tmp, sizeof(tmp));
break;
+ }
default:
assert(!"Should not get here.");
break;
case GLSL_TYPE_BOOL:
dst[didx].i = src[sidx].i ? 1 : 0;
break;
- case GLSL_TYPE_DOUBLE:
- dst[didx].i = IROUNDD(*(double *)&src[sidx].f);
+ case GLSL_TYPE_DOUBLE: {
+ double tmp;
+ memcpy(&tmp, &src[sidx].f, sizeof(tmp));
+ dst[didx].i = IROUNDD(tmp);
break;
+ }
default:
assert(!"Should not get here.");
break;
case GLSL_TYPE_FLOAT:
printf("%g ", v[i].f);
break;
- case GLSL_TYPE_DOUBLE:
- printf("%g ", *(double* )&v[i * 2].f);
+ case GLSL_TYPE_DOUBLE: {
+ double tmp;
+ memcpy(&tmp, &v[i * 2].f, sizeof(tmp));
+ printf("%g ", tmp);
break;
+ }
default:
assert(!"Should not get here.");
break;