diff options
author | Robert C. Helling <helling@atdotde.de> | 2021-10-01 15:50:21 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2021-10-01 08:50:36 -0700 |
commit | 41258647d232a24adca394202b44b204409b4c9f (patch) | |
tree | a1c0b94973d5e8795cd3b8dba44542c2efa2bdbb /core/gas.h | |
parent | 5e9ee9febb595ced1699e1f60a659e01266ec7e9 (diff) | |
download | subsurface-41258647d232a24adca394202b44b204409b4c9f.tar.gz |
Don't access gasmix.o2.fraction
Air is a special gas that does not contain oxygen according
to gasmix.o2.fraction. If you want to use the fo2, you
need to use get_o2() to treat this special case correctly.
This fixes a bug when setting the MND of a gas containing
21% oxygen when o2 is considered not narcotic.
Reported-by: Christoph Gruen <gruen.christoph@gmail.com>
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Diffstat (limited to 'core/gas.h')
-rw-r--r-- | core/gas.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/core/gas.h b/core/gas.h index 83eef72e9..b3c539c61 100644 --- a/core/gas.h +++ b/core/gas.h @@ -44,12 +44,12 @@ extern double isothermal_pressure(struct gasmix gas, double p1, int volume1, int extern double gas_density(struct gasmix gas, int pressure); extern int same_gasmix(struct gasmix a, struct gasmix b); -static inline int get_o2(struct gasmix mix) +static inline int get_o2(const struct gasmix mix) { return mix.o2.permille ?: O2_IN_AIR; } -static inline int get_he(struct gasmix mix) +static inline int get_he(const struct gasmix mix) { return mix.he.permille; } @@ -74,6 +74,7 @@ extern bool gasmix_is_air(struct gasmix gasmix); extern bool gasmix_is_invalid(struct gasmix mix); extern enum gastype gasmix_to_type(struct gasmix mix); extern const char *gastype_name(enum gastype type); +extern fraction_t make_fraction(int f); #ifdef __cplusplus } |