1 | /* |
1 | /* |
2 | * This file is part of Deliantra, the Roguelike Realtime MMORPG. |
2 | * This file is part of Deliantra, the Roguelike Realtime MMORPG. |
3 | * |
3 | * |
|
|
4 | * Copyright (©) 2017,2018 Marc Alexander Lehmann / the Deliantra team |
4 | * Copyright (©) 2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016 Marc Alexander Lehmann / Robin Redeker / the Deliantra team |
5 | * Copyright (©) 2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016 Marc Alexander Lehmann / Robin Redeker / the Deliantra team |
5 | * Copyright (©) 2002-2005 Mark Wedel & Crossfire Development Team |
6 | * Copyright (©) 2002-2005 Mark Wedel & Crossfire Development Team |
6 | * Copyright (©) 1992 Frank Tore Johansen |
7 | * Copyright (©) 1992 Frank Tore Johansen |
7 | * |
8 | * |
8 | * Deliantra is free software: you can redistribute it and/or modify it under |
9 | * Deliantra is free software: you can redistribute it and/or modify it under |
… | |
… | |
157 | void update_ (); |
158 | void update_ (); |
158 | MTH void update () |
159 | MTH void update () |
159 | { |
160 | { |
160 | // we take advantage of the fact that 0x80 is the sign bit |
161 | // we take advantage of the fact that 0x80 is the sign bit |
161 | // to generate more efficient code on many cpus |
162 | // to generate more efficient code on many cpus |
162 | assert (sint8 (P_UPTODATE) < 0); |
163 | //assert (sint8 (P_UPTODATE) < 0); |
163 | assert (sint8 (-1 & ~P_UPTODATE) >= 0); |
164 | //assert (sint8 (-1 & ~P_UPTODATE) >= 0); |
164 | |
165 | |
165 | if (expect_false (sint8 (flags_) >= 0)) |
166 | if (expect_false (sint8 (flags_) >= 0)) |
166 | update_ (); |
167 | update_ (); |
167 | |
168 | |
168 | // must be true by now (gcc seems content with only the second test) |
169 | // must be true by now (gcc seems content with only the second test) |
169 | assume (sint8 (flags_) < 0); |
170 | ecb_assume (sint8 (flags_) < 0); |
170 | assume (flags_ & P_UPTODATE); |
171 | ecb_assume (flags_ & P_UPTODATE); |
171 | } |
172 | } |
172 | |
173 | |
173 | MTH uint8 flags () |
174 | MTH uint8 flags () |
174 | { |
175 | { |
175 | update (); |
176 | update (); |