mirror of
https://github.com/AxioDL/kabufuda.git
synced 2025-05-13 10:51:20 +00:00
Proper fragmentation handling
This commit is contained in:
parent
fe835efd71
commit
aa36b77af6
@ -4,7 +4,6 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
#include "Util.hpp"
|
#include "Util.hpp"
|
||||||
|
|
||||||
namespace kabufuda
|
namespace kabufuda
|
||||||
|
@ -393,12 +393,11 @@ uint16_t BlockAllocationTable::allocateBlocks(uint16_t count, uint16_t maxBlocks
|
|||||||
uint16_t tmpCount = count;
|
uint16_t tmpCount = count;
|
||||||
while ((count--) > 0)
|
while ((count--) > 0)
|
||||||
{
|
{
|
||||||
if (count == 0)
|
|
||||||
m_map[(freeBlock - FSTBlocks)] = 0xFFFF;
|
m_map[(freeBlock - FSTBlocks)] = 0xFFFF;
|
||||||
else
|
if (count != 0)
|
||||||
{
|
{
|
||||||
m_map[(freeBlock - FSTBlocks)] = freeBlock + 1;
|
m_map[(freeBlock - FSTBlocks)] = nextFreeBlock(maxBlocks - FSTBlocks, m_lastAllocated + 1);
|
||||||
freeBlock = nextFreeBlock(maxBlocks - FSTBlocks, m_lastAllocated + 1);
|
freeBlock = m_map[(freeBlock - FSTBlocks)];
|
||||||
}
|
}
|
||||||
m_lastAllocated = freeBlock;
|
m_lastAllocated = freeBlock;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user