# \[Solved-\>int is fine\] Shouldn't AbstractFifo use long instead of int?

**URL:** <https://forum.juce.com/t/solved-int-is-fine-shouldnt-abstractfifo-use-long-instead-of-int/23792>\
**Category:** General JUCE discussion\
**Created:** [August 18, 2017, 8:58am UTC](https://forum.juce.com/t/solved-int-is-fine-shouldnt-abstractfifo-use-long-instead-of-int/23792 "2017-08-18T08:58:30Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![tsenkov](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/tsenkov/32/3150_2.png) [@tsenkov](https://forum.juce.com/u/tsenkov)\
**Post date:** [August 18, 2017, 8:58am UTC](https://forum.juce.com/t/solved-int-is-fine-shouldnt-abstractfifo-use-long-instead-of-int/23792/1 "2017-08-18T08:58:30Z")

</div>

_I apologize for a potential stupid question in advance. This seems too big of an issue no one to have hit it before, so I probably am too tired and just don’t see something obvious here._

I am buffering the last few seconds of my plugin’s output, for analysis on a different thread.

In order not to lock the Audio Thread while buffering, I use an AbstractFifo. But I am puzzled by it having int’s for all indexes and size… For example if I have a 192kHz signal, 5 sec would amount to:  
5 \* 192 000 = 960 000 samples

Even if I buffer only small chunks (say, every block call) of samples, I would still get indexes that can’t be represented as int’s, right?

Shouldn’t the AbstractFifo be templated so we can use it with larger size arrays/buffer/etc.?

Thanks for the input and again - sorry if the question is not appropriate.

**Update:**  
Seems on modern compilers `int` is no longer `+-2^15`, but is instead equal to `long`, which is `+-2^31`.  
So AbstractFifo should work just fine up until `2 147 483 647` items.  
[http://en.cppreference.com/w/cpp/language/types](http://en.cppreference.com/w/cpp/language/types)

---

<div class="post-metadata">

**Author:** ![chkn](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/chkn/32/3862_2.png) [@chkn](https://forum.juce.com/u/chkn)\
**Post date:** [August 18, 2017, 9:28am UTC](https://forum.juce.com/t/solved-int-is-fine-shouldnt-abstractfifo-use-long-instead-of-int/23792/2 "2017-08-18T09:28:55Z")

</div>

As long your buffer is smaller than 2147483648 samples, this shouldn’t be problem

---

<div class="post-metadata">

**Author:** ![tsenkov](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/tsenkov/32/3150_2.png) [@tsenkov](https://forum.juce.com/u/tsenkov)\
**Post date:** [August 18, 2017, 9:38am UTC](https://forum.juce.com/t/solved-int-is-fine-shouldnt-abstractfifo-use-long-instead-of-int/23792/3 "2017-08-18T09:38:28Z")

</div>

> [@chkn](#):
>
> 2147483648

I thought the limits for `int` are `+- 2^15`, while the number above is `2^31`. Isn’t this the same as `long`?

Thanks @chkn. And sorry for the stupid question.

I found multiple places quoting 2^15 when searching for this. I think compilers made this change and now `int` and `long` don’t differ? Anyways - problem is solved (or better yet - nonexistent).

---

<div class="post-metadata">

**Author:** ![chkn](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/chkn/32/3862_2.png) [@chkn](https://forum.juce.com/u/chkn)\
**Post date:** [August 18, 2017, 10:17am UTC](https://forum.juce.com/t/solved-int-is-fine-shouldnt-abstractfifo-use-long-instead-of-int/23792/4 "2017-08-18T10:17:59Z")

</div>

the table below should answer all questions:

[http://en.cppreference.com/w/cpp/language/types](http://en.cppreference.com/w/cpp/language/types)
