morphisms: remove 'return 0;' at end since it is now added by default

This commit is contained in:
Michael Sippel 2025-04-03 16:37:46 +02:00
parent 3f1397735c
commit ef819b4711
Signed by: senvas
GPG key ID: F96CF119C34B64A6
11 changed files with 42 additions and 107 deletions

View file

@ -5,68 +5,42 @@
morph_angle_as_degrees_to_turns_float ()
Angle ~ Degrees ~ ~ native.Float32
--> Angle ~ Turns ~ ~ native.Float32
```
*dst = *src / 360.0;
return 0;
```
```*dst = *src / 360.0;```
morph_angle_as_degrees_to_turns_double ()
Angle ~ Degrees ~ ~ native.Float64
--> Angle ~ Turns ~ ~ native.Float64
```
*dst = *src / 360.0;
return 0;
```
```*dst = *src / 360.0;```
morph_angle_as_turns_to_degrees_float ()
Angle ~ Turns ~ ~ native.Float32
--> Angle ~ Degrees ~ ~ native.Float32
```
*dst = *src * 360.0;
return 0;
```
```*dst = *src * 360.0;```
morph_angle_as_turns_to_degrees_double ()
Angle ~ Turns ~ ~ native.Float64
--> Angle ~ Degrees ~ ~ native.Float64
```
*dst = *src * 360.0;
return 0;
```
```*dst = *src * 360.0;```
morph_angle_as_radians_to_turns_float ()
Angle ~ Radians ~ ~ native.Float32
--> Angle ~ Turns ~ ~ native.Float32
```
*dst = *src / PHI;
return 0;
```
```*dst = *src / PHI;```
morph_angle_as_radians_to_turns_double ()
Angle ~ Radians ~ ~ native.Float64
--> Angle ~ Turns ~ ~ native.Float64
```
*dst = *src / PHI;
return 0;
```
```*dst = *src / PHI;```
morph_angle_as_turns_to_radians_float ()
Angle ~ Turns ~ ~ native.Float32
--> Angle ~ Radians ~ ~ native.Float32
```
*dst = *src * PHI;
return 0;
```
```*dst = *src * PHI;```
morph_angle_as_degrees_to_radians_double ()
Angle ~ Turns ~ ~ native.Float64
--> Angle ~ Radians ~ ~ native.Float64
```
*dst = *src * PHI;
return 0;
```
```*dst = *src * PHI;```

View file

@ -60,8 +60,6 @@ morph_digit_as_uint8_to_char (Radix:_16)
fprintf(stderr, "digit %u is out of rage for char\n", *dst);
return -1;
}
return 0;
```
morph_digit_as_uint64_to_char (Radix:_16)
@ -76,6 +74,4 @@ morph_digit_as_uint64_to_char (Radix:_16)
fprintf(stderr, "digit %u is out of rage for char\n", *dst);
return -1;
}
return 0;
```

View file

@ -10,8 +10,6 @@ morph_array_as_valterm_to_lenpfx (Terminator:native.UInt8)
length_prefix_uint64_t_array_uint8_t_clear(dst);
while( *src != Terminator )
length_prefix_uint64_t_array_uint8_t_push(dst, *src++);
return 0;
```
@ -23,8 +21,6 @@ morph_array_as_lenpfx_to_valterm (Terminator:native.UInt8)
*dst++ = src->items[i];
*dst = Terminator;
return 0;
```
morph_array_as_lenpfx_to_continuation_bit (T:Type)
@ -42,6 +38,4 @@ morph_array_as_lenpfx_to_continuation_bit (T:Type)
if( i+1 < src->len )
dst[i] |= (1<<(n_bits-1));
}
return 0;
```

View file

@ -11,7 +11,6 @@ morph_nat_as_u64_to_pos ()
```
dst->len = 1;
dst->items[0] = *src;
return 0;
```
morph_nat_as_pos_to_u64 (Endianness:Type)
@ -22,7 +21,6 @@ morph_nat_as_pos_to_u64 (Endianness:Type)
~ native.UInt64
```
*dst = src->items[0];
return 0;
```
morph_posint_radix_le (SrcRadix:, DstRadix:)
@ -52,8 +50,6 @@ morph_posint_radix_le (SrcRadix:, DstRadix:)
value /= DstRadix;
}
#endif
return 0;
```
morph_posint_radix_be (SrcRadix:, DstRadix:)
@ -91,8 +87,6 @@ morph_posint_radix_be (SrcRadix:, DstRadix:)
value /= DstRadix;
}
#endif
return 0;
```
morph_posint_endianness (Radix:)

View file

@ -5,43 +5,27 @@
morph_real_as_decimalstr_to_float ()
~ <PosInt 10 BigEndian> ~ <Seq~<ValueTerminated 0> <Digit 10>~Char~Ascii~native.UInt8>
--> ~ native.Float32
```
sscanf(src, "%f", dst);
return 0;
```
```sscanf(src, "%f", dst);```
morph_real_as_decimalstr_to_double ()
~ <PosInt 10 BigEndian> ~ <Seq~<ValueTerminated 0> <Digit 10>~Char~Ascii~native.UInt8>
--> ~ native.Float64
```
sscanf(src, "%lf", dst);
return 0;
```
```sscanf(src, "%lf", dst);```
morph_real_as_float_to_decimalstr ()
~ native.Float32
--> ~ <PosInt 10 BigEndian> ~ <Seq~<ValueTerminated 0> <Digit 10>~Char~Ascii~native.UInt8>
```
sprintf(dst, "%f", *src);
return 0;
```
```sprintf(dst, "%f", *src);```
morph_real_as_double_to_decimalstr ()
~ native.Float64
--> ~ <PosInt 10 BigEndian> ~ <Seq~<ValueTerminated 0> <Digit 10>~Char~Ascii~native.UInt8>
```
sprintf(dst, "%f", *src);
return 0;
```
```sprintf(dst, "%f", *src);```
morph_real_as_float_to_double ()
~ native.Float32
--> ~ native.Float64
```
*dst = *src;
return 0;
```
```*dst = *src;```
morph_real_as_double_to_float ()
~ native.Float64
@ -49,7 +33,6 @@ morph_real_as_double_to_float ()
```
fprintf(stderr, "Warning: morphin Double -> Float. Precision loss!");
*dst = *src;
return 0;
```
morph_real_as_u64_to_float ()
@ -58,7 +41,6 @@ morph_real_as_u64_to_float ()
```
fprintf(stderr, "Warning: morphin UInt64 -> Float. Precision loss!");
*dst = *src;
return 0;
```
morph_real_as_u64_to_double ()
@ -67,7 +49,14 @@ morph_real_as_u64_to_double ()
```
fprintf(stderr, "Warning: morphin UInt64 -> Double. Precision loss!");
*dst = *src;
return 0;
```
morph_real_as_nat_to_quantized_linear ()
~ ~ native.UInt64
--> ~ <QuantizedLinear 0 1 1> ~ ~ native.UInt64
```
*dst = *src;
```
morph_real_as_quantized_linear_to_float (Begin: , End: , Steps: )
@ -75,7 +64,6 @@ morph_real_as_quantized_linear_to_float (Begin: , End: , Steps: )
--> ~ native.Float32
```
*dst = (float)Begin + ( *src * ((float)End - (float)Begin) ) / (float)Steps;
return 0;
```
morph_real_as_float_to_quantized_linear (Begin: , End: , Steps: )
@ -83,7 +71,6 @@ morph_real_as_float_to_quantized_linear (Begin: , End: , Steps: )
--> ~ <QuantizedLinear Begin End Steps> ~ ~ native.UInt64
```
*dst = ((*src - (float)Begin) * (float)Steps) / ((float)End - (float)Begin);
return 0;
```
@ -93,7 +80,6 @@ morph_real_as_quantized_linear_to_double (Begin: , End: , Steps: )
--> ~ native.Float64
```
*dst = (double)Begin + ( *src * ((double)End - (double)Begin) ) / (double)Steps;
return 0;
```
morph_real_as_double_to_quantized_linear (Begin: , End: , Steps: )
@ -101,5 +87,4 @@ morph_real_as_double_to_quantized_linear (Begin: , End: , Steps: )
--> ~ <QuantizedLinear Begin End Steps> ~ ~ native.UInt64
```
*dst = ((*src - (double)Begin) * (double)Steps) / ((double)End - (double)Begin);
return 0;
```

View file

@ -4,31 +4,19 @@
morph_celsius_to_kelvin ()
Temperature ~ Celsius ~ ~ native.Float32
--> Temperature ~ Kelvin ~ ~ native.Float32
```
*dst = *src + 273.15;
return 0;
```
```*dst = *src + 273.15;```
morph_kelvin_to_celsius ()
Temperature ~ Kelvin ~ ~ native.Float32
--> Temperature ~ Celsius ~ ~ native.Float32
```
*dst = *src - 273.15;
return 0;
```
```*dst = *src - 273.15;```
morph_celsius_to_fahrenheit ()
Temperature ~ Celsius ~ ~ native.Float32
--> Temperature ~ Fahrenheit ~ ~ native.Float32
```
*dst = (*src * 9.0 / 5.0) + 32.0;
return 0;
```
```*dst = (*src * 9.0 / 5.0) + 32.0;```
morph_fahrenheit_to_celsius ()
Temperature ~ Fahrenheit ~ ~ native.Float32
--> Temperature ~ Celsius ~ ~ native.Float32
```
*dst = (*src - 32.0) * 5.0 / 9.0;
return 0;
```
```*dst = (*src - 32.0) * 5.0 / 9.0;```

View file

@ -11,5 +11,4 @@ morph_unixtime_to_iso ()
if (!timeinfo) return -1;
strftime((char*)dst, 20, "%Y-%m-%dT%H:%M:%SZ", timeinfo);
return 0;
```

View file

@ -0,0 +1,17 @@
```
```
morph_nat_as_u8_to_u16 ()
~ native.UInt8
--> ~ native.UInt16
```*dst = *src;```
morph_nat_as_u16_to_u32 ()
~ native.UInt16
--> ~ native.UInt32
```*dst = *src;```
morph_nat_as_u32_to_u64 ()
~ native.UInt32
--> ~ native.UInt64
```*dst = *src;```

View file

@ -28,7 +28,6 @@ morph_string_as_utf8_to_ascii ()
}
}
*dst = 0;
return 0;
```
morph_string_as_ascii_to_utf32 ()
@ -39,7 +38,6 @@ morph_string_as_ascii_to_utf32 ()
```
while( *src ) { *dst++ = *src++; }
*dst = 0;
return 0;
```
morph_string_as_utf8_to_utf32 ()
@ -89,6 +87,4 @@ morph_string_as_utf8_to_utf32 ()
*dst++ = val;
*dst++ = 0;
return 0;
```

View file

@ -27,8 +27,6 @@ morph_seqseq_valsep_uint8 (T: Type, SrcDelim: T, DstDelim: T)
length_prefix_uint64_t_array_uint8_t_push( dst, src->items[i] );
}
}
return 0;
```
@ -66,8 +64,6 @@ morph_seqseq_as_valsep_to_lenpfx (T: Type, Delim: T, EscKey: T)
cur++;
}
}
return 0;
```
morph_seqeq_as_lenpfx_to_valsep (T: Type, Delim: T, EscKey: T)
@ -94,6 +90,4 @@ morph_seqeq_as_lenpfx_to_valsep (T: Type, Delim: T, EscKey: T)
length_prefix_uint64_t_array_uint8_t_push( Delim );
}
}
return 0;
```

View file

@ -10,8 +10,6 @@ morph_i64_as_twos_complement_to_zigzag ()
} else {
*dst = (2 * (uint64_t)(- *src)) - 1;
}
return 0;
```
morph_i64_as_zigzag_to_twos_complement ()