Category Archives: Programming

Programming related.

FUN With AVX

Over the last few years, Intel and AMD have added 256-bit vector-support to their processors. The support for these wider vectors is commonly known as AVX (Advanced Vector eXtension). Since wider vectors also introduce more processor-state, in order to use … Continue reading

Posted in FOX, Programming | Leave a comment

Fast Power of Two Test

A quick and nifty check to see if a number is a power of two is to note that for numbers that are a power of two, you’ll get a number which is all ones. For example: 1000 -1 0111 … Continue reading

Posted in Programming | Leave a comment

The Case for Negative Semaphore Counts

The new FXParallel feature being worked on in FOX has a atomic variable for tracking completed tasks of a task-group.  This kind of works as follows: 1 2 3 if(atomicAdd(&counter,-1)==1){ completion.post(); }if(atomicAdd(&counter,-1)==1){ completion.post(); } In other words, when the specified … Continue reading

Posted in FOX, Programming | Leave a comment

Conversion of Unsigned Int to Float

Conversion of unsigned int to float appears to be difficult for x86-64 processor. However, signed int to float is directly supported in the hardware. The GCC compiler is clever enough to use the hardware instruction CVTSI2SS. However in the case … Continue reading

Posted in Programming | Leave a comment

Half Floats

Some time ago, I wrote an implementation of the “half float” class.  This implements 16-bit floating point numbers, particularly conversion of these to and from single precision 32-bit floats, which are supported by most hardware. The crucial idea was to … Continue reading

Posted in FOX, Programming | Leave a comment

Switching Between GCC and LLVM

While GCC still generates faster code (for me, at least!), LLVM does generate nice warnings. In fact, LLVM caught two problems for me today that GCC overlooked. Self-comparisons, like: if(m>m) … Technically, this is of course perfectly legal C++.  But … Continue reading

Posted in Programming | Leave a comment