[DiscordArchive] Does anybody know what this operator does in c++?
[DiscordArchive] Does anybody know what this operator does in c++?
Archived author: Skarn • Posted: 2019-05-15T17:10:04.485000+00:00
Original source
damn I hate that language so much for that bullshit
Archived author: schlumpf • Posted: 2019-05-15T17:10:13.925000+00:00
Original source
yes, but at least not inline assembly and defined by intel, not the vendors
Archived author: schlumpf • Posted: 2019-05-15T17:10:31.726000+00:00
Original source
it isn't a language issue thoguh? you can write perfectly platform independent code that does that.
Archived author: schlumpf • Posted: 2019-05-15T17:10:38.281000+00:00
Original source
it is just an utterly low level optimization
Archived author: Skarn • Posted: 2019-05-15T17:10:47.116000+00:00
Original source
yeah, but you are allowed to write non-platform independent code
Archived author: Skarn • Posted: 2019-05-15T17:10:48.748000+00:00
Original source
that's the issue
Archived author: Skarn • Posted: 2019-05-15T17:11:02.406000+00:00
Original source
and the code that is not using any WInAPI stuff or whatever
Archived author: Skarn • Posted: 2019-05-15T17:11:23.848000+00:00
Original source
just general purpose code that is not crossplatform because the language gives freedom to compilers in their own implementation of things
Archived author: schlumpf • Posted: 2019-05-15T17:17:24.694000+00:00
Original source
```
unsigned int msb32(unsigned int x)
{
for (unsigned int m = 31; m; --m)
{
if (x & (1 << m)) return m;
}
}
```
Archived author: schlumpf • Posted: 2019-05-15T17:18:59.354000+00:00
Original source
as you see, it doesn't optimize to a single instruction, which is why the library author decided that he would prefer performance over portability.