comparison dvdnav.c @ 264:8c86b61eb06f src

fix compiler warnings related to aliasing violations
author mroi
date Wed, 20 Apr 2005 16:16:20 +0000
parents d999338cab17
children 99d33725395d
comparison
equal deleted inserted replaced
263:d999338cab17 264:8c86b61eb06f
1090 /* 1090 /*
1091 * user_ops_t is a structure of 32 bits. We want to compute 1091 * user_ops_t is a structure of 32 bits. We want to compute
1092 * the union of two of those bitfields so to make this quicker 1092 * the union of two of those bitfields so to make this quicker
1093 * than performing 32 ORs, we will access them as 32bits words. 1093 * than performing 32 ORs, we will access them as 32bits words.
1094 */ 1094 */
1095 uint32_t ops=0; 1095 union {
1096 1096 user_ops_t ops_struct;
1097 if(!this) { 1097 uint32_t ops_int;
1098 printerr("Passed a NULL pointer."); 1098 } ops;
1099 return *(user_ops_t*)&ops; 1099
1100 ops.ops_int = 0;
1101
1102 if(!this) {
1103 printerr("Passed a NULL pointer.");
1104 return ops.ops_struct;
1100 } 1105 }
1101 if(!this->started) { 1106 if(!this->started) {
1102 printerr("Virtual DVD machine not started."); 1107 printerr("Virtual DVD machine not started.");
1103 return *(user_ops_t*)&ops; 1108 return ops.ops_struct;
1104 } 1109 }
1105 1110
1106 pthread_mutex_lock(&this->vm_lock); 1111 pthread_mutex_lock(&this->vm_lock);
1107 ops|=*(uint32_t*)&this->pci.pci_gi.vobu_uop_ctl; 1112 ops.ops_int |= *(uint32_t*)&this->pci.pci_gi.vobu_uop_ctl;
1108 1113
1109 if(this->vm && this->vm->state.pgc) 1114 if(this->vm && this->vm->state.pgc)
1110 ops|=*(uint32_t*)&this->vm->state.pgc->prohibited_ops; 1115 ops.ops_int |= *(uint32_t*)&this->vm->state.pgc->prohibited_ops;
1111 pthread_mutex_unlock(&this->vm_lock); 1116 pthread_mutex_unlock(&this->vm_lock);
1112 1117
1113 return *(user_ops_t*)&ops; 1118 return ops.ops_struct;
1114 } 1119 }