Manage big endian/little endian

This commit is contained in:
Laurent Vivier 2006-05-29 19:56:13 +00:00
parent b2e366a3c5
commit de2860a35c
5 changed files with 14 additions and 9 deletions

View File

@ -7,14 +7,15 @@ static __attribute__((used)) char* rcsid = "$CVSHeader$";
#include "partition.h"
#include "libemile.h"
#include "emile.h"
int emile_map_geometry(emile_map_t *map, int *block_size, int *block_count)
{
if (!emile_map_is_valid(map))
return -1;
*block_size = map->drivers.BlkSize;
*block_count = map->drivers.BlkCount;
*block_size = read_short(&map->drivers.BlkSize);
*block_count = read_long(&map->drivers.BlkCount);
return 0;
}

View File

@ -7,6 +7,7 @@ static __attribute__((used)) char* rcsid = "$CVSHeader$";
#include "partition.h"
#include "libemile.h"
#include "emile.h"
int emile_map_get_driver_info(emile_map_t *map, int number,
int *block, int *size, int* type)
@ -17,9 +18,9 @@ int emile_map_get_driver_info(emile_map_t *map, int number,
if (number > emile_map_get_driver_number(map))
return -1;
*block = map->drivers.DrvInfo[number].Block;
*size = map->drivers.DrvInfo[number].Size;
*type = map->drivers.DrvInfo[number].Type;
*block = read_long(&map->drivers.DrvInfo[number].Block);
*size = read_short(&map->drivers.DrvInfo[number].Size);
*type = read_short(&map->drivers.DrvInfo[number].Type);
return 0;
}

View File

@ -7,11 +7,12 @@ static __attribute__((used)) char* rcsid = "$CVSHeader$";
#include "partition.h"
#include "libemile.h"
#include "emile.h"
int emile_map_get_driver_number(emile_map_t *map)
{
if (!emile_map_is_valid(map))
return -1;
return map->drivers.DrvrCount;
return read_short(&map->drivers.DrvrCount);
}

View File

@ -7,14 +7,15 @@ static __attribute__((used)) char* rcsid = "$CVSHeader$";
#include "partition.h"
#include "libemile.h"
#include "emile.h"
int emile_map_get_partition_geometry(emile_map_t *map, int *start, int *count)
{
if (!emile_map_partition_is_valid(map))
return -1;
*start = map->partition.PyPartStart;
*count = map->partition.PartBlkCnt;
*start = read_long(&map->partition.PyPartStart);
*count = read_long(&map->partition.PartBlkCnt);
return 0;
}

View File

@ -7,8 +7,9 @@ static __attribute__((used)) char* rcsid = "$CVSHeader$";
#include "partition.h"
#include "libemile.h"
#include "emile.h"
int emile_map_is_valid(emile_map_t *map)
{
return map->drivers.Sig == DD_SIGNATURE;
return read_short(&map->drivers.Sig) == DD_SIGNATURE;
}