October 15th, 2013, 08:06 AM
Fegetexceptflag() and fesetexceptflag()
I have gone through lot web pages but still unable to figure out how the above two functions work.
the function fegetexceptflag (fexcept_t *flagp, int excepts)
gets full contents of the exceptions from the status word and places it in *flagp.
1. Does it mean "it store the entire status word (all 16 bits or per implementation) with the exception bits logically AND'ed with the bits in excepts to fetch only the interested exception bits". Doing so I guess apart from the exception flags all other bits are set to 0's.
2. What I understand from the above link is that the function fesetexceptflag (const fexcept_t *flagp, int excepts) fetches the entire status flag bits as stored from above function into *flagp and then applies logical AND with the bits as contained in excepts to get only the interested exception flags. The function only derives the exception flags from the AND operation and updates the exception flags of the status register, the other bits of status register are untouched by the function.
Could some one please guide me if I am wrong and in such case how the above functions work.