%if EXISTS("_DSPGIVENSROTLIB_") == 0
%assign _DSPGIVENSROTLIB_ = 1
%if !EXISTS("dspGivensRotUtils")
%createrecord dspGivensRotUtils { ...
NothingMacro 1}
%endif
%function dspGivensRot(dTypeIdentifier, xptr, yptr, cptr, sptr) Output
%if ((dTypeIdentifier == "D") || (dTypeIdentifier == "Z"))
%assign utilityName = "rotg"
%assign ptrLabel = "real_T*"
%assign valLabel = "real_T"
%assign constLabel = ""
%assign CHYPOT = "CHYPOT"
%assign fabs = "fabs"
%else
%assign utilityName = "rotg32"
%assign ptrLabel = "real32_T*"
%assign valLabel = "real32_T"
%assign constLabel = "F"
%assign CHYPOT = "CHYPOT32"
%assign fabs = "fabsf"
%endif
%if SLibInBlockScope()
%assign block = SLibGetCurrentBlock()
%else
%assign block = ""
%endif
%assign utilityName = SLibRegisterSharedUtility(block, utilityName)
%<FcnTrackSharedUtilHeaderFileUsage(utilityName + ".h", TLC_FALSE)>
%<utilityName>(%<xptr>, %<yptr>, %<cptr>, %<sptr>)
%if !(ISFIELD(dspGivensRotUtils, utilityName))
%<LibPushEmptyStackSharedUtils()>/
%assign tmpRet = SETFIELD(dspGivensRotUtils,utilityName,1)
%assign funcDeclarationRoot = "void %<utilityName>(%<ptrLabel> x, %<ptrLabel> y, %<ptrLabel> c, %<ptrLabel> s)"
%openfile funcProto
%<funcDeclarationRoot>;
%closefile funcProto
%openfile utilityDef
#include "dsp_rt.h"
%<funcDeclarationRoot>
{
%<valLabel> rho, r, z, absx, absy;
rho = ((absx = %<fabs>(*x)) > (absy = %<fabs>(*y))) ? *x : *y;
%<CHYPOT>(*x, *y, r);
r = (rho > 0.0%<constLabel>) ? r : -r;
*c = (r == 0.0%<constLabel>) ? 1.0%<constLabel> : *x / r;
*s = (r == 0.0%<constLabel>) ? 0.0%<constLabel> : *y / r;
z = (absx > absy) ? *s : 1.0%<constLabel>;
z = (absy >= absx && *c != 0.0%<constLabel>) ? 1.0%<constLabel> / *c : z;
*x = r;
*y = z;
}
%closefile utilityDef
%<SLibAddMathIncludeForUtilsSourceCode(utilityDef)>
%<SLibDumpUtilsSourceCodeAndCacheFunctionPrototype(utilityName,funcProto,utilityDef)>/
%assign GSUStackBuf = LibPopStackSharedUtilsIncludes()
%endif
%endfunction
%endif