You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ignite.apache.org by "Andrey Gura (JIRA)" <ji...@apache.org> on 2017/09/21 15:36:00 UTC
[jira] [Updated] (IGNITE-6470) Wrong casting of long value to int
leads to incorrect results
[ https://issues.apache.org/jira/browse/IGNITE-6470?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Andrey Gura updated IGNITE-6470:
--------------------------------
Description:
Wrong casting of {{long}} value to {{int}} leads to incorrect results:
{code:java}
/** {@inheritDoc} */
@Override public int pages() {
if (!inited)
return 0;
// allocated.get() returns long value. We should cast it to int after division.
return (int)((allocated.get() - headerSize()) / pageSize);
}
{code}
was:
Wrong casting of long value to int leads to incorrect results:
{code:java}
/** {@inheritDoc} */
@Override public int pages() {
if (!inited)
return 0;
// allocated.get() returns long value. We should cast it to int after division.
return (int)((allocated.get() - headerSize()) / pageSize);
}
{code}
> Wrong casting of long value to int leads to incorrect results
> -------------------------------------------------------------
>
> Key: IGNITE-6470
> URL: https://issues.apache.org/jira/browse/IGNITE-6470
> Project: Ignite
> Issue Type: Bug
> Affects Versions: 2.2
> Reporter: Andrey Gura
> Assignee: Andrey Gura
> Fix For: 2.3
>
>
> Wrong casting of {{long}} value to {{int}} leads to incorrect results:
> {code:java}
> /** {@inheritDoc} */
> @Override public int pages() {
> if (!inited)
> return 0;
>
> // allocated.get() returns long value. We should cast it to int after division.
> return (int)((allocated.get() - headerSize()) / pageSize);
> }
> {code}
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)