I have the following code

```
    void Fun2()
    {
        if(X<=A)
            X=ceil(M*1.0/A*X);
        else
            X=M*1.0/(M-A)*(M-X);
    }

```

I want to program it in fast manner using C99, take into account the following comments.

1. `X`and `A`, are 32 bit variables and I declare them as `uint64_t`, While `M` as `static const uint64_t`.
2. This function is called by another function and the value of `A` are changed to a new value every `n` times of calling.
3. The optimization is needed in the execution time, CPU is Core i3, OS is windows 7

The math model I want to implement it is

```
F=ceil(Max/A*X) if x<=A

F=floor(M/(M-A)*(M-X)) if x>A

```

For clarity and no confusion My previous post was 
I have the following code

```
void Fun2()
{
    if(X0<=A)
        X0=ceil(Max1*X0);
    else
        X0=Max2*(Max-X0);
}

```

I want to program it in fast manner using C99, take into account the following comments.

1. X0, A, Max1, and Max2 are 32 bit variable and I declare them as uint64\_t, While Max as static const uint64\_t.
2. This function is called by another function and the values of Max1, A, Max2 are changed to random values every n times of calling.
3. I work in Windows 7 and in codeblocks software

Thanks