Yes but unfortunately, implementing atomic increments based on CAS are always like that. For reference if you look at jdk Semaphore implementation for tryAcquire() you will see similar code:

```
            for (;;) {
                int available = getState();
                int remaining = available - acquires;
                if (remaining < 0 ||
                    compareAndSetState(available, remaining))
                    return remaining;
            }
```

or AtomicInteger.incrementAndGet()

```
        for (;;) {
            int current = get();
            int next = current + 1;
            if (compareAndSet(current, next))
                return next;
        }
```

I am open to suggestions if you have a better way to do this.