mirror of
https://github.com/genodelabs/genode.git
synced 2025-02-06 11:10:24 +00:00
base: fix location_of_index affinity calculation
Take care that ypos parameter is smaller than height(). If it is not - wrap around. Issue #1412.
This commit is contained in:
parent
babe1d1026
commit
a594ae703d
@ -75,7 +75,13 @@ namespace Genode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return location of a single CPU of specified index
|
* Return the location of the Nth CPU within the affinity
|
||||||
|
* space
|
||||||
|
*
|
||||||
|
* This function returns a valid location even if the index
|
||||||
|
* is larger than the number of CPUs in the space. In this
|
||||||
|
* case, the x and y coordinates are wrapped by the bounds
|
||||||
|
* of the space.
|
||||||
*/
|
*/
|
||||||
inline Location location_of_index(int index);
|
inline Location location_of_index(int index);
|
||||||
};
|
};
|
||||||
@ -178,7 +184,7 @@ namespace Genode {
|
|||||||
|
|
||||||
Affinity::Location Affinity::Space::location_of_index(int index)
|
Affinity::Location Affinity::Space::location_of_index(int index)
|
||||||
{
|
{
|
||||||
return Location(index % _width, index / _width, 1, 1);
|
return Location(index % _width, (index / _width) % _height, 1, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user