Recent Posts

Pages: [1] 2 3 ... 10
Yeah, sometimes the compiler is able to optimize it away, but it's not totally reliable, and YMMV depending on the compiler. Math operations are probably the best case for this though, whereas more special-case things like memcpy/memset inlining when using a constexpr size tends to not work properly with multiple degrees of inlining.
Graphics Update / Re: Health & Welfare
« Last post by Hooman on Today at 04:09:17 AM »
All so good, it's hard to choose. I kind of liked A the best, ... but maybe that's saying something about me, and being a stickler for rules.  :-\  Ehh, I'm going to go have a shower.
Graphics Update / Re: Science Structures
« Last post by Hooman on Today at 03:59:06 AM »
I rather like 01A. The single dome 02A is also pretty cool looking, though yes, considerably more plain, and a bit like an arena.

For some reason the blue doesn't look quite as nice to me. It seems a bit jarring. No idea why though.
Ahh, that makes sense. Frontload the work. I was stuck thinking of a single divide rather than an array divide.

Thanks for the pop count link, that was good review. The bit manipulations has a rather interesting structure.

As for the algorithm complexity, if you were being pedantic, any algorithm is constant time when you fix the input size. As the pop count instruction works on a fixed number of bits (the register size), it is of course constant time. Though you may notice from the algorithm, the actual number of instructions depends on the number of bits involved in the counting. Looks to be logarithmic in the number of bits, which is pretty efficient. And of course, having a machine opcode to do it is always handy. Looks like it can be done quite efficiently at the hardware level.

I do rather enjoy the conversion (A % B) => (A & (B - 1)) when B is a power of 2. I use a slight variant of that for rounding up to the next multiple of a power of 2: roundUp(value, multiple) = (value + (multiple - 1)) & ~(multiple - 1)

I tried your suggestion to pass a constexpr through a non-constexpr function. It seems the g++ optimizer is too good. I was not able to fool it with my simple test:

Code: cpp [Select]

unsigned int addOne(unsigned int x) {
  return x + 1;

unsigned int divideByTwo(unsigned int x) {
  return x / addOne(1);

The result of g++ -c -S -masm=intel -O2 constExprArg.cpp is:
Code: asm [Select]

lea eax, 1[rdi]


mov eax, edi
shr eax         ; Shift right (logical): Divide by 2

Graphics Update / Re: Production & Commercial
« Last post by White Claw on October 14, 2018, 08:56:09 PM »
In one of the pictures Leeor posted, I noticed the commercial building looked out of scale compared to everything else. After some discussion with Leeor, here are some adjustments. (Along with the previous for comparison.)
Graphics Update / Re: Production & Commercial
« Last post by leeor_net on October 14, 2018, 08:13:26 PM »
The so-called button things are present on the original structures from OUTPOST. They make sense in a couple of senses -- they help to provide additional detail so things aren't so mundane and structurally I could see these as similar to building 'tie rods' for lack of a better term (I'm not an architect...  :-[ ).

Like in the attached image, you have the center point where all of the structural struts come together. The 'button' acts as a sort of 'cap' to provide a pleasant aesthetic finish and could even house some sort of machine room type of deal (though in this case probably something like regulatory computers).

Basically, it works for me. :)
Graphics Update / Re: Production & Commercial
« Last post by White Claw on October 14, 2018, 08:12:10 PM »
Okay...Here's the UG factory without any color adjustment, and more white-ish windows. I've also included what I would consider the "existing" yellow windows (with unsaturated colors). If that makes any sense...
Graphics Update / Re: Production & Commercial
« Last post by White Claw on October 14, 2018, 07:58:37 PM »
I've really got to get rid of my desire to see clean-sheet designs.

I'm not creative enough to make this many buildings from a clean-sheet design. If someone's able to offer up some concept art, I'm all ears (or eyes, or whatever...).

One question, why do nearly all of the UG structures have the "button" on top of the cylindrical components?

The only two buildings that have this sort of button are the commercial and factory. Many have some sort of shape at the top of the dome, so maybe that's what you mean? Many of the underground buildings are rounded or domes, which tend to look fairly plain if they don't have something on the top center (such as the science lab, which has a fairly blank center on the dome).

And no offense, but it kind of looks like it has weeds growing on top of it.

No offence taken, but I'm not entirely sure what you mean...?
Graphics Update / Re: Science Structures
« Last post by White Claw on October 14, 2018, 07:53:04 PM »
Incidentally (in the picture above), the nursery, science lab, and park have modified (saturated) colors. While the medical center, university, vertical tube, and commercial building are not color modified.
Graphics Update / Re: Science Structures
« Last post by White Claw on October 14, 2018, 07:47:19 PM »
Edit: Deleted. I put this in the wrong thread... :o
Pages: [1] 2 3 ... 10