equal
deleted
inserted
replaced
404 * type, eg one with other flags because it is parsed |
404 * type, eg one with other flags because it is parsed |
405 * @return returns the value of the pointer-setting */ |
405 * @return returns the value of the pointer-setting */ |
406 int64 ReadValue(const void *ptr, VarType conv) |
406 int64 ReadValue(const void *ptr, VarType conv) |
407 { |
407 { |
408 switch (GetVarMemType(conv)) { |
408 switch (GetVarMemType(conv)) { |
409 case SLE_VAR_BL: return (*(bool*)ptr == 1); |
409 case SLE_VAR_BL: return (*(bool*)ptr != 0); |
410 case SLE_VAR_I8: return *(int8* )ptr; |
410 case SLE_VAR_I8: return *(int8* )ptr; |
411 case SLE_VAR_U8: return *(byte* )ptr; |
411 case SLE_VAR_U8: return *(byte* )ptr; |
412 case SLE_VAR_I16: return *(int16* )ptr; |
412 case SLE_VAR_I16: return *(int16* )ptr; |
413 case SLE_VAR_U16: return *(uint16*)ptr; |
413 case SLE_VAR_U16: return *(uint16*)ptr; |
414 case SLE_VAR_I32: return *(int32* )ptr; |
414 case SLE_VAR_I32: return *(int32* )ptr; |
429 * with other flags. It is parsed upon read |
429 * with other flags. It is parsed upon read |
430 * @param var the new value being given to the variable */ |
430 * @param var the new value being given to the variable */ |
431 void WriteValue(void *ptr, VarType conv, int64 val) |
431 void WriteValue(void *ptr, VarType conv, int64 val) |
432 { |
432 { |
433 switch (GetVarMemType(conv)) { |
433 switch (GetVarMemType(conv)) { |
434 case SLE_VAR_BL: *(bool *)ptr = (val == 1); break; |
434 case SLE_VAR_BL: *(bool *)ptr = (val != 0); break; |
435 case SLE_VAR_I8: *(int8 *)ptr = val; break; |
435 case SLE_VAR_I8: *(int8 *)ptr = val; break; |
436 case SLE_VAR_U8: *(byte *)ptr = val; break; |
436 case SLE_VAR_U8: *(byte *)ptr = val; break; |
437 case SLE_VAR_I16: *(int16 *)ptr = val; break; |
437 case SLE_VAR_I16: *(int16 *)ptr = val; break; |
438 case SLE_VAR_U16: *(uint16*)ptr = val; break; |
438 case SLE_VAR_U16: *(uint16*)ptr = val; break; |
439 case SLE_VAR_I32: *(int32 *)ptr = val; break; |
439 case SLE_VAR_I32: *(int32 *)ptr = val; break; |