Remove the now-unused arithmatic interface to the dss
This commit was SVN r17654.
Этот коммит содержится в:
родитель
2b5fab9d51
Коммит
2e1bda6d23
@ -26,7 +26,6 @@ headers += \
|
||||
|
||||
libopen_pal_la_SOURCES += \
|
||||
dss/dss_internal_functions.c \
|
||||
dss/dss_arith.c \
|
||||
dss/dss_compare.c \
|
||||
dss/dss_copy.c \
|
||||
dss/dss_dump.c \
|
||||
|
@ -485,46 +485,6 @@ typedef int (*opal_dss_set_fn_t)(opal_dss_value_t *value, void *new_value, opal_
|
||||
*/
|
||||
typedef int (*opal_dss_get_fn_t)(void **data, opal_dss_value_t *value, opal_data_type_t type);
|
||||
|
||||
/**
|
||||
* Perform an arithemetic operation on a data value
|
||||
*
|
||||
* Since the data values are stored in an opaque manner, the system needs
|
||||
* a function by which it can manipulate the data value within the data_value object. This
|
||||
* is the equivalent to a C++ access function.
|
||||
*
|
||||
* @retval OPAL_SUCCESS The value was successfully retrieved
|
||||
*
|
||||
* @retval OPAL_ERROR(s) An appropriate error code - usually caused by the specified type
|
||||
* not matching the data type within the stored object.
|
||||
*/
|
||||
typedef int (*opal_dss_arith_fn_t)(opal_dss_value_t *value, opal_dss_value_t *operand, opal_dss_arith_op_t operation);
|
||||
|
||||
/**
|
||||
* Increment a data value
|
||||
*
|
||||
* Since the data values are stored in an opaque manner, the system needs
|
||||
* a function by which it can manipulate the data value within the data_value object. This
|
||||
* is the equivalent to a C++ access function.
|
||||
*
|
||||
* @retval OPAL_SUCCESS The value was successfully retrieved
|
||||
*
|
||||
* @retval OPAL_ERROR(s) An appropriate error code.
|
||||
*/
|
||||
typedef int (*opal_dss_increment_fn_t)(opal_dss_value_t *value);
|
||||
|
||||
/**
|
||||
* Decrement a data value
|
||||
*
|
||||
* Since the data values are stored in an opaque manner, the system needs
|
||||
* a function by which it can manipulate the data value within the data_value object. This
|
||||
* is the equivalent to a C++ access function.
|
||||
*
|
||||
* @retval OPAL_SUCCESS The value was successfully retrieved
|
||||
*
|
||||
* @retval OPAL_ERROR(s) An appropriate error code.
|
||||
*/
|
||||
typedef int (*opal_dss_decrement_fn_t)(opal_dss_value_t *value);
|
||||
|
||||
/**
|
||||
* Release the storage used by a data value
|
||||
*
|
||||
@ -605,9 +565,6 @@ typedef int (*opal_dss_unpack_buffer_fn_t)(opal_buffer_t *buffer, void *dest,
|
||||
struct opal_dss_t {
|
||||
opal_dss_set_fn_t set;
|
||||
opal_dss_get_fn_t get;
|
||||
opal_dss_arith_fn_t arith;
|
||||
opal_dss_increment_fn_t increment;
|
||||
opal_dss_decrement_fn_t decrement;
|
||||
opal_dss_set_buffer_type_fn_t set_buffer_type;
|
||||
opal_dss_pack_fn_t pack;
|
||||
opal_dss_unpack_fn_t unpack;
|
||||
|
@ -1,666 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
|
||||
* University Research and Technology
|
||||
* Corporation. All rights reserved.
|
||||
* Copyright (c) 2004-2006 The University of Tennessee and The University
|
||||
* of Tennessee Research Foundation. All rights
|
||||
* reserved.
|
||||
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
||||
* University of Stuttgart. All rights reserved.
|
||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*/
|
||||
|
||||
#include "opal_config.h"
|
||||
|
||||
#include "opal/dss/dss_internal.h"
|
||||
|
||||
static void opal_dss_arith_int(int *value, int *operand, opal_dss_arith_op_t operation);
|
||||
static void opal_dss_arith_uint(uint *value, uint *operand, opal_dss_arith_op_t operation);
|
||||
static void opal_dss_arith_size(size_t *value, size_t *operand, opal_dss_arith_op_t operation);
|
||||
static void opal_dss_arith_pid(pid_t *value, pid_t *operand, opal_dss_arith_op_t operation);
|
||||
static void opal_dss_arith_byte(uint8_t *value, uint8_t *operand, opal_dss_arith_op_t operation);
|
||||
static void opal_dss_arith_int8(int8_t *value, int8_t *operand, opal_dss_arith_op_t operation);
|
||||
static void opal_dss_arith_int16(int16_t *value, int16_t *operand, opal_dss_arith_op_t operation);
|
||||
static void opal_dss_arith_uint16(uint16_t *value, uint16_t *operand, opal_dss_arith_op_t operation);
|
||||
static void opal_dss_arith_int32(int32_t *value, int32_t *operand, opal_dss_arith_op_t operation);
|
||||
static void opal_dss_arith_uint32(uint32_t *value, uint32_t *operand, opal_dss_arith_op_t operation);
|
||||
static void opal_dss_arith_int64(int64_t *value, int64_t *operand, opal_dss_arith_op_t operation);
|
||||
static void opal_dss_arith_uint64(uint64_t *value, uint64_t *operand, opal_dss_arith_op_t operation);
|
||||
|
||||
/* some weird ones - but somebody *might* want to do it, I suppose... */
|
||||
static void opal_dss_arith_data_type(opal_data_type_t *value, opal_data_type_t *operand, opal_dss_arith_op_t operation);
|
||||
|
||||
int opal_dss_arith(opal_dss_value_t *value, opal_dss_value_t *operand, opal_dss_arith_op_t operation)
|
||||
{
|
||||
/* check for error */
|
||||
if (NULL == value || NULL == operand) {
|
||||
return OPAL_ERR_BAD_PARAM;
|
||||
}
|
||||
if (operand->type != value->type) {
|
||||
return OPAL_ERR_TYPE_MISMATCH;
|
||||
}
|
||||
|
||||
/* Lookup the arith function for this type and call it */
|
||||
|
||||
switch(operand->type) {
|
||||
case OPAL_INT:
|
||||
opal_dss_arith_int((int*)value->data, (int*)operand->data, operation);
|
||||
break;
|
||||
|
||||
case OPAL_UINT:
|
||||
opal_dss_arith_uint((uint*)value->data, (uint*)operand->data, operation);
|
||||
break;
|
||||
|
||||
case OPAL_SIZE:
|
||||
opal_dss_arith_size((size_t*)value->data, (size_t*)operand->data, operation);
|
||||
break;
|
||||
|
||||
case OPAL_PID:
|
||||
opal_dss_arith_pid((pid_t*)value->data, (pid_t*)operand->data, operation);
|
||||
break;
|
||||
|
||||
case OPAL_BYTE:
|
||||
case OPAL_UINT8:
|
||||
opal_dss_arith_byte((uint8_t*)value->data, (uint8_t*)operand->data, operation);
|
||||
break;
|
||||
|
||||
case OPAL_INT8:
|
||||
opal_dss_arith_int8((int8_t*)value->data, (int8_t*)operand->data, operation);
|
||||
break;
|
||||
|
||||
case OPAL_INT16:
|
||||
opal_dss_arith_int16((int16_t*)value->data, (int16_t*)operand->data, operation);
|
||||
break;
|
||||
|
||||
case OPAL_UINT16:
|
||||
opal_dss_arith_uint16((uint16_t*)value->data, (uint16_t*)operand->data, operation);
|
||||
break;
|
||||
|
||||
case OPAL_INT32:
|
||||
opal_dss_arith_int32((int32_t*)value->data, (int32_t*)operand->data, operation);
|
||||
break;
|
||||
|
||||
case OPAL_UINT32:
|
||||
opal_dss_arith_uint32((uint32_t*)value->data, (uint32_t*)operand->data, operation);
|
||||
break;
|
||||
|
||||
case OPAL_INT64:
|
||||
opal_dss_arith_int64((int64_t*)value->data, (int64_t*)operand->data, operation);
|
||||
break;
|
||||
|
||||
case OPAL_UINT64:
|
||||
opal_dss_arith_uint64((uint64_t*)value->data, (uint64_t*)operand->data, operation);
|
||||
break;
|
||||
|
||||
default:
|
||||
return OPAL_ERR_OPERATION_UNSUPPORTED;
|
||||
}
|
||||
|
||||
return OPAL_SUCCESS;
|
||||
}
|
||||
|
||||
int opal_dss_increment(opal_dss_value_t *value)
|
||||
{
|
||||
int one;
|
||||
unsigned int uone;
|
||||
size_t sone;
|
||||
pid_t pone;
|
||||
uint8_t u8one;
|
||||
int8_t i8one;
|
||||
uint16_t u16one;
|
||||
int16_t i16one;
|
||||
uint32_t u32one;
|
||||
int32_t i32one;
|
||||
uint64_t u64one;
|
||||
int64_t i64one;
|
||||
opal_data_type_t datatypeone;
|
||||
|
||||
/* check for error */
|
||||
if (NULL == value) {
|
||||
return OPAL_ERR_BAD_PARAM;
|
||||
}
|
||||
/* Lookup the arith function for this type and call it */
|
||||
|
||||
switch(value->type) {
|
||||
case OPAL_INT:
|
||||
one = 1;
|
||||
opal_dss_arith_int((int*)value->data, &one, OPAL_DSS_ADD);
|
||||
break;
|
||||
|
||||
case OPAL_UINT:
|
||||
uone = 1;
|
||||
opal_dss_arith_uint((uint*)value->data, &uone, OPAL_DSS_ADD);
|
||||
break;
|
||||
|
||||
case OPAL_SIZE:
|
||||
sone = 1;
|
||||
opal_dss_arith_size((size_t*)value->data, &sone, OPAL_DSS_ADD);
|
||||
break;
|
||||
|
||||
case OPAL_PID:
|
||||
pone = 1;
|
||||
opal_dss_arith_pid((pid_t*)value->data, &pone, OPAL_DSS_ADD);
|
||||
break;
|
||||
|
||||
case OPAL_BYTE:
|
||||
case OPAL_UINT8:
|
||||
u8one = 1;
|
||||
opal_dss_arith_byte((uint8_t*)value->data, &u8one, OPAL_DSS_ADD);
|
||||
break;
|
||||
|
||||
case OPAL_INT8:
|
||||
i8one = 1;
|
||||
opal_dss_arith_int8((int8_t*)value->data, &i8one, OPAL_DSS_ADD);
|
||||
break;
|
||||
|
||||
case OPAL_INT16:
|
||||
i16one = 1;
|
||||
opal_dss_arith_int16((int16_t*)value->data, &i16one, OPAL_DSS_ADD);
|
||||
break;
|
||||
|
||||
case OPAL_UINT16:
|
||||
u16one = 1;
|
||||
opal_dss_arith_uint16((uint16_t*)value->data, &u16one, OPAL_DSS_ADD);
|
||||
break;
|
||||
|
||||
case OPAL_INT32:
|
||||
i32one = 1;
|
||||
opal_dss_arith_int32((int32_t*)value->data, &i32one, OPAL_DSS_ADD);
|
||||
break;
|
||||
|
||||
case OPAL_UINT32:
|
||||
u32one = 1;
|
||||
opal_dss_arith_uint32((uint32_t*)value->data, &u32one, OPAL_DSS_ADD);
|
||||
break;
|
||||
|
||||
case OPAL_INT64:
|
||||
i64one = 1;
|
||||
opal_dss_arith_int64((int64_t*)value->data, &i64one, OPAL_DSS_ADD);
|
||||
break;
|
||||
|
||||
case OPAL_UINT64:
|
||||
u64one = 1;
|
||||
opal_dss_arith_uint64((uint64_t*)value->data, &u64one, OPAL_DSS_ADD);
|
||||
break;
|
||||
|
||||
case OPAL_DATA_TYPE:
|
||||
datatypeone = 1;
|
||||
opal_dss_arith_data_type((opal_data_type_t*)value->data, &datatypeone, OPAL_DSS_ADD);
|
||||
break;
|
||||
|
||||
default:
|
||||
return OPAL_ERR_OPERATION_UNSUPPORTED;
|
||||
}
|
||||
|
||||
return OPAL_SUCCESS;
|
||||
}
|
||||
|
||||
int opal_dss_decrement(opal_dss_value_t *value)
|
||||
{
|
||||
int one;
|
||||
unsigned int uone;
|
||||
size_t sone;
|
||||
pid_t pone;
|
||||
uint8_t u8one;
|
||||
int8_t i8one;
|
||||
uint16_t u16one;
|
||||
int16_t i16one;
|
||||
uint32_t u32one;
|
||||
int32_t i32one;
|
||||
uint64_t u64one;
|
||||
int64_t i64one;
|
||||
opal_data_type_t datatypeone;
|
||||
|
||||
/* check for error */
|
||||
if (NULL == value) {
|
||||
return OPAL_ERR_BAD_PARAM;
|
||||
}
|
||||
/* Lookup the arith function for this type and call it */
|
||||
|
||||
switch(value->type) {
|
||||
case OPAL_INT:
|
||||
one = 1;
|
||||
opal_dss_arith_int((int*)value->data, &one, OPAL_DSS_SUB);
|
||||
break;
|
||||
|
||||
case OPAL_UINT:
|
||||
uone = 1;
|
||||
opal_dss_arith_uint((uint*)value->data, &uone, OPAL_DSS_SUB);
|
||||
break;
|
||||
|
||||
case OPAL_SIZE:
|
||||
sone = 1;
|
||||
opal_dss_arith_size((size_t*)value->data, &sone, OPAL_DSS_SUB);
|
||||
break;
|
||||
|
||||
case OPAL_PID:
|
||||
pone = 1;
|
||||
opal_dss_arith_pid((pid_t*)value->data, &pone, OPAL_DSS_SUB);
|
||||
break;
|
||||
|
||||
case OPAL_BYTE:
|
||||
case OPAL_UINT8:
|
||||
u8one = 1;
|
||||
opal_dss_arith_byte((uint8_t*)value->data, &u8one, OPAL_DSS_SUB);
|
||||
break;
|
||||
|
||||
case OPAL_INT8:
|
||||
i8one = 1;
|
||||
opal_dss_arith_int8((int8_t*)value->data, &i8one, OPAL_DSS_SUB);
|
||||
break;
|
||||
|
||||
case OPAL_INT16:
|
||||
i16one = 1;
|
||||
opal_dss_arith_int16((int16_t*)value->data, &i16one, OPAL_DSS_SUB);
|
||||
break;
|
||||
|
||||
case OPAL_UINT16:
|
||||
u16one = 1;
|
||||
opal_dss_arith_uint16((uint16_t*)value->data, &u16one, OPAL_DSS_SUB);
|
||||
break;
|
||||
|
||||
case OPAL_INT32:
|
||||
i32one = 1;
|
||||
opal_dss_arith_int32((int32_t*)value->data, &i32one, OPAL_DSS_SUB);
|
||||
break;
|
||||
|
||||
case OPAL_UINT32:
|
||||
u32one = 1;
|
||||
opal_dss_arith_uint32((uint32_t*)value->data, &u32one, OPAL_DSS_SUB);
|
||||
break;
|
||||
|
||||
case OPAL_INT64:
|
||||
i64one = 1;
|
||||
opal_dss_arith_int64((int64_t*)value->data, &i64one, OPAL_DSS_SUB);
|
||||
break;
|
||||
|
||||
case OPAL_UINT64:
|
||||
u64one = 1;
|
||||
opal_dss_arith_uint64((uint64_t*)value->data, &u64one, OPAL_DSS_SUB);
|
||||
break;
|
||||
|
||||
case OPAL_DATA_TYPE:
|
||||
datatypeone = 1;
|
||||
opal_dss_arith_data_type((opal_data_type_t*)value->data, &datatypeone, OPAL_DSS_SUB);
|
||||
break;
|
||||
|
||||
default:
|
||||
return OPAL_ERR_OPERATION_UNSUPPORTED;
|
||||
}
|
||||
|
||||
return OPAL_SUCCESS;
|
||||
}
|
||||
|
||||
/*
|
||||
* NUMERIC arith FUNCTIONS
|
||||
*/
|
||||
static void opal_dss_arith_int(int *value, int *operand, opal_dss_arith_op_t operation)
|
||||
{
|
||||
switch(operation) {
|
||||
case OPAL_DSS_ADD:
|
||||
(*value) += *operand;
|
||||
break;
|
||||
|
||||
case OPAL_DSS_SUB:
|
||||
(*value) -= *operand;
|
||||
break;
|
||||
|
||||
case OPAL_DSS_MUL:
|
||||
(*value) *= *operand;
|
||||
break;
|
||||
|
||||
case OPAL_DSS_DIV:
|
||||
if (0 == *operand) {
|
||||
return;
|
||||
}
|
||||
(*value) /= *operand;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
static void opal_dss_arith_uint(uint *value, uint *operand, opal_dss_arith_op_t operation)
|
||||
{
|
||||
switch(operation) {
|
||||
case OPAL_DSS_ADD:
|
||||
(*value) += *operand;
|
||||
break;
|
||||
|
||||
case OPAL_DSS_SUB:
|
||||
(*value) -= *operand;
|
||||
break;
|
||||
|
||||
case OPAL_DSS_MUL:
|
||||
(*value) *= *operand;
|
||||
break;
|
||||
|
||||
case OPAL_DSS_DIV:
|
||||
if (0 == *operand) {
|
||||
return;
|
||||
}
|
||||
(*value) /= *operand;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
static void opal_dss_arith_size(size_t *value, size_t *operand, opal_dss_arith_op_t operation)
|
||||
{
|
||||
switch(operation) {
|
||||
case OPAL_DSS_ADD:
|
||||
(*value) += *operand;
|
||||
break;
|
||||
|
||||
case OPAL_DSS_SUB:
|
||||
(*value) -= *operand;
|
||||
break;
|
||||
|
||||
case OPAL_DSS_MUL:
|
||||
(*value) *= *operand;
|
||||
break;
|
||||
|
||||
case OPAL_DSS_DIV:
|
||||
if (0 == *operand) {
|
||||
return;
|
||||
}
|
||||
(*value) /= *operand;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
static void opal_dss_arith_pid(pid_t *value, pid_t *operand, opal_dss_arith_op_t operation)
|
||||
{
|
||||
switch(operation) {
|
||||
case OPAL_DSS_ADD:
|
||||
(*value) += *operand;
|
||||
break;
|
||||
|
||||
case OPAL_DSS_SUB:
|
||||
(*value) -= *operand;
|
||||
break;
|
||||
|
||||
case OPAL_DSS_MUL:
|
||||
(*value) *= *operand;
|
||||
break;
|
||||
|
||||
case OPAL_DSS_DIV:
|
||||
if (0 == *operand) {
|
||||
return;
|
||||
}
|
||||
(*value) /= *operand;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
static void opal_dss_arith_byte(uint8_t *value, uint8_t *operand, opal_dss_arith_op_t operation)
|
||||
{
|
||||
switch(operation) {
|
||||
case OPAL_DSS_ADD:
|
||||
(*value) += *operand;
|
||||
break;
|
||||
|
||||
case OPAL_DSS_SUB:
|
||||
(*value) -= *operand;
|
||||
break;
|
||||
|
||||
case OPAL_DSS_MUL:
|
||||
(*value) *= *operand;
|
||||
break;
|
||||
|
||||
case OPAL_DSS_DIV:
|
||||
if (0 == *operand) {
|
||||
return;
|
||||
}
|
||||
(*value) /= *operand;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
static void opal_dss_arith_int8(int8_t *value, int8_t *operand, opal_dss_arith_op_t operation)
|
||||
{
|
||||
switch(operation) {
|
||||
case OPAL_DSS_ADD:
|
||||
(*value) += *operand;
|
||||
break;
|
||||
|
||||
case OPAL_DSS_SUB:
|
||||
(*value) -= *operand;
|
||||
break;
|
||||
|
||||
case OPAL_DSS_MUL:
|
||||
(*value) *= *operand;
|
||||
break;
|
||||
|
||||
case OPAL_DSS_DIV:
|
||||
if (0 == *operand) {
|
||||
return;
|
||||
}
|
||||
(*value) /= *operand;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
static void opal_dss_arith_int16(int16_t *value, int16_t *operand, opal_dss_arith_op_t operation)
|
||||
{
|
||||
switch(operation) {
|
||||
case OPAL_DSS_ADD:
|
||||
(*value) += *operand;
|
||||
break;
|
||||
|
||||
case OPAL_DSS_SUB:
|
||||
(*value) -= *operand;
|
||||
break;
|
||||
|
||||
case OPAL_DSS_MUL:
|
||||
(*value) *= *operand;
|
||||
break;
|
||||
|
||||
case OPAL_DSS_DIV:
|
||||
if (0 == *operand) {
|
||||
return;
|
||||
}
|
||||
(*value) /= *operand;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
static void opal_dss_arith_uint16(uint16_t *value, uint16_t *operand, opal_dss_arith_op_t operation)
|
||||
{
|
||||
switch(operation) {
|
||||
case OPAL_DSS_ADD:
|
||||
(*value) += *operand;
|
||||
break;
|
||||
|
||||
case OPAL_DSS_SUB:
|
||||
(*value) -= *operand;
|
||||
break;
|
||||
|
||||
case OPAL_DSS_MUL:
|
||||
(*value) *= *operand;
|
||||
break;
|
||||
|
||||
case OPAL_DSS_DIV:
|
||||
if (0 == *operand) {
|
||||
return;
|
||||
}
|
||||
(*value) /= *operand;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
static void opal_dss_arith_int32(int32_t *value, int32_t *operand, opal_dss_arith_op_t operation)
|
||||
{
|
||||
switch(operation) {
|
||||
case OPAL_DSS_ADD:
|
||||
(*value) += *operand;
|
||||
break;
|
||||
|
||||
case OPAL_DSS_SUB:
|
||||
(*value) -= *operand;
|
||||
break;
|
||||
|
||||
case OPAL_DSS_MUL:
|
||||
(*value) *= *operand;
|
||||
break;
|
||||
|
||||
case OPAL_DSS_DIV:
|
||||
if (0 == *operand) {
|
||||
return;
|
||||
}
|
||||
(*value) /= *operand;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
static void opal_dss_arith_uint32(uint32_t *value, uint32_t *operand, opal_dss_arith_op_t operation)
|
||||
{
|
||||
switch(operation) {
|
||||
case OPAL_DSS_ADD:
|
||||
(*value) += *operand;
|
||||
break;
|
||||
|
||||
case OPAL_DSS_SUB:
|
||||
(*value) -= *operand;
|
||||
break;
|
||||
|
||||
case OPAL_DSS_MUL:
|
||||
(*value) *= *operand;
|
||||
break;
|
||||
|
||||
case OPAL_DSS_DIV:
|
||||
if (0 == *operand) {
|
||||
return;
|
||||
}
|
||||
(*value) /= *operand;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
static void opal_dss_arith_int64(int64_t *value, int64_t *operand, opal_dss_arith_op_t operation)
|
||||
{
|
||||
switch(operation) {
|
||||
case OPAL_DSS_ADD:
|
||||
(*value) += *operand;
|
||||
break;
|
||||
|
||||
case OPAL_DSS_SUB:
|
||||
(*value) -= *operand;
|
||||
break;
|
||||
|
||||
case OPAL_DSS_MUL:
|
||||
(*value) *= *operand;
|
||||
break;
|
||||
|
||||
case OPAL_DSS_DIV:
|
||||
if (0 == *operand) {
|
||||
return;
|
||||
}
|
||||
(*value) /= *operand;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
static void opal_dss_arith_uint64(uint64_t *value, uint64_t *operand, opal_dss_arith_op_t operation)
|
||||
{
|
||||
switch(operation) {
|
||||
case OPAL_DSS_ADD:
|
||||
(*value) += *operand;
|
||||
break;
|
||||
|
||||
case OPAL_DSS_SUB:
|
||||
(*value) -= *operand;
|
||||
break;
|
||||
|
||||
case OPAL_DSS_MUL:
|
||||
(*value) *= *operand;
|
||||
break;
|
||||
|
||||
case OPAL_DSS_DIV:
|
||||
if (0 == *operand) {
|
||||
return;
|
||||
}
|
||||
(*value) /= *operand;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
static void opal_dss_arith_data_type(opal_data_type_t *value, opal_data_type_t *operand, opal_dss_arith_op_t operation)
|
||||
{
|
||||
switch(operation) {
|
||||
case OPAL_DSS_ADD:
|
||||
(*value) += *operand;
|
||||
break;
|
||||
|
||||
case OPAL_DSS_SUB:
|
||||
(*value) -= *operand;
|
||||
break;
|
||||
|
||||
case OPAL_DSS_MUL:
|
||||
(*value) *= *operand;
|
||||
break;
|
||||
|
||||
case OPAL_DSS_DIV:
|
||||
if (0 == *operand) {
|
||||
return;
|
||||
}
|
||||
(*value) /= *operand;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -213,12 +213,6 @@ extern opal_data_type_t opal_dss_num_reg_types;
|
||||
|
||||
int opal_dss_get(void **data, opal_dss_value_t *value, opal_data_type_t type);
|
||||
|
||||
int opal_dss_arith(opal_dss_value_t *value, opal_dss_value_t *operand, opal_dss_arith_op_t operation);
|
||||
|
||||
int opal_dss_increment(opal_dss_value_t *value);
|
||||
|
||||
int opal_dss_decrement(opal_dss_value_t *value);
|
||||
|
||||
int opal_dss_set_buffer_type(opal_buffer_t *buffer, opal_dss_buffer_type_t type);
|
||||
|
||||
int opal_dss_pack(opal_buffer_t *buffer, const void *src,
|
||||
|
@ -39,9 +39,6 @@ opal_dss_buffer_type_t default_buf_type;
|
||||
opal_dss_t opal_dss = {
|
||||
opal_dss_set,
|
||||
opal_dss_get,
|
||||
opal_dss_arith,
|
||||
opal_dss_increment,
|
||||
opal_dss_decrement,
|
||||
opal_dss_set_buffer_type,
|
||||
opal_dss_pack,
|
||||
opal_dss_unpack,
|
||||
|
@ -77,15 +77,6 @@ typedef struct {
|
||||
#define OPAL_VALUE2_GREATER -1
|
||||
#define OPAL_EQUAL 0
|
||||
|
||||
/* define arithmetic operations for readability */
|
||||
typedef uint8_t opal_dss_arith_op_t;
|
||||
|
||||
#define OPAL_DSS_ADD 1
|
||||
#define OPAL_DSS_SUB 2
|
||||
#define OPAL_DSS_MUL 3
|
||||
#define OPAL_DSS_DIV 4
|
||||
|
||||
|
||||
/* Data value object */
|
||||
typedef struct {
|
||||
opal_object_t super; /* required for this to be an object */
|
||||
|
@ -1,4 +1,4 @@
|
||||
PROGS = dss_buffer dss_payload dss_cmp dss_copy dss_inc_dec dss_print dss_release dss_set_get dss_size
|
||||
PROGS = dss_buffer dss_payload dss_cmp dss_copy dss_print dss_release dss_set_get dss_size
|
||||
|
||||
all: $(PROGS)
|
||||
|
||||
|
@ -1,609 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
||||
* University Research and Technology
|
||||
* Corporation. All rights reserved.
|
||||
* Copyright (c) 2004-2005 The University of Tennessee and The University
|
||||
* of Tennessee Research Foundation. All rights
|
||||
* reserved.
|
||||
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
||||
* University of Stuttgart. All rights reserved.
|
||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*/
|
||||
|
||||
#include "opal_config.h"
|
||||
#include "opal/constants.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "opal/runtime/opal.h"
|
||||
|
||||
#include "opal/dss/dss.h"
|
||||
|
||||
#define NUM_ITERS 3
|
||||
#define NUM_ELEMS 10
|
||||
|
||||
static bool test1(void); /* verify different buffer inits */
|
||||
static bool test2(void); /* verify int16 */
|
||||
static bool test3(void); /* verify int */
|
||||
static bool test4(void); /* verify int32 */
|
||||
static bool test5(void); /* verify int64 */
|
||||
static bool test6(void); /* verify string */
|
||||
static bool test7(void); /* verify BOOL */
|
||||
static bool test8(void); /* verify OBJECT */
|
||||
static bool test9(void); /* verify composite (multiple types and element counts) */
|
||||
static bool test11(void); /* verify size_t */
|
||||
static bool test12(void); /* verify pid_t */
|
||||
|
||||
FILE *test_out;
|
||||
|
||||
|
||||
int main (int argc, char* argv[])
|
||||
{
|
||||
opal_init();
|
||||
|
||||
test_out = stderr;
|
||||
|
||||
/* run the tests */
|
||||
|
||||
fprintf(test_out, "executing test1\n");
|
||||
if (test1()) {
|
||||
fprintf(test_out, "Test1 succeeded\n");
|
||||
}
|
||||
else {
|
||||
fprintf(test_out, "Test1 failed\n");
|
||||
}
|
||||
|
||||
fprintf(test_out, "executing test2\n");
|
||||
if (test2()) {
|
||||
fprintf(test_out, "Test2 succeeded\n");
|
||||
}
|
||||
else {
|
||||
fprintf(test_out, "Test2 failed\n");
|
||||
}
|
||||
|
||||
fprintf(test_out, "executing test3\n");
|
||||
if (test3()) {
|
||||
fprintf(test_out, "Test3 succeeded\n");
|
||||
}
|
||||
else {
|
||||
fprintf(test_out, "Test3 failed\n");
|
||||
}
|
||||
|
||||
fprintf(test_out, "executing test4\n");
|
||||
if (test4()) {
|
||||
fprintf(test_out, "Test4 succeeded\n");
|
||||
}
|
||||
else {
|
||||
fprintf(test_out, "Test4 failed\n");
|
||||
}
|
||||
|
||||
fprintf(test_out, "executing test5\n");
|
||||
if (test5()) {
|
||||
fprintf(test_out, "Test5 succeeded\n");
|
||||
}
|
||||
else {
|
||||
fprintf(test_out, "Test5 failed\n");
|
||||
}
|
||||
|
||||
fprintf(test_out, "executing test6\n");
|
||||
if (test6()) {
|
||||
fprintf(test_out, "Test6 succeeded\n");
|
||||
}
|
||||
else {
|
||||
fprintf(test_out, "Test6 failed\n");
|
||||
}
|
||||
|
||||
fprintf(test_out, "executing test7\n");
|
||||
if (test7()) {
|
||||
fprintf(test_out, "Test7 succeeded\n");
|
||||
}
|
||||
else {
|
||||
fprintf(test_out, "Test7 failed\n");
|
||||
}
|
||||
|
||||
fprintf(test_out, "executing test8\n");
|
||||
if (test8()) {
|
||||
fprintf(test_out, "Test8 succeeded\n");
|
||||
}
|
||||
else {
|
||||
fprintf(test_out, "Test8 failed\n");
|
||||
}
|
||||
|
||||
fprintf(test_out, "executing test9\n");
|
||||
if (test9()) {
|
||||
fprintf(test_out, "Test9 succeeded\n");
|
||||
}
|
||||
else {
|
||||
fprintf(test_out, "opal_dss test9 failed\n");
|
||||
}
|
||||
|
||||
fprintf(test_out, "executing test11\n");
|
||||
if (test11()) {
|
||||
fprintf(test_out, "Test11 succeeded\n");
|
||||
}
|
||||
else {
|
||||
fprintf(test_out, "opal_dss test11 failed\n");
|
||||
}
|
||||
|
||||
fprintf(test_out, "executing test12\n");
|
||||
if (test12()) {
|
||||
fprintf(test_out, "Test12 succeeded\n");
|
||||
}
|
||||
else {
|
||||
fprintf(test_out, "opal_dss test12 failed\n");
|
||||
}
|
||||
|
||||
fclose(test_out);
|
||||
|
||||
opal_finalize();
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
/*
|
||||
* INT8
|
||||
*/
|
||||
static bool test1(void)
|
||||
{
|
||||
int8_t v1, v2=100;
|
||||
uint8_t u1, u2=150;
|
||||
opal_data_type_t type=OPAL_INT8, utype=OPAL_UINT8;
|
||||
opal_dss_value_t dv;
|
||||
|
||||
dv.type = type;
|
||||
dv.data = &v2;
|
||||
v1 = v2;
|
||||
|
||||
if (OPAL_SUCCESS != opal_dss.increment(&dv)) {
|
||||
fprintf(test_out, "opal_dss.increment returned error\n");
|
||||
return(false);
|
||||
}
|
||||
if (v2 != v1+1) {
|
||||
fprintf(test_out, "opal_dss.increment failed for signed value\n");
|
||||
return(false);
|
||||
}
|
||||
|
||||
if (OPAL_SUCCESS != opal_dss.decrement(&dv)) {
|
||||
fprintf(test_out, "opal_dss.decrement returned error\n");
|
||||
return(false);
|
||||
}
|
||||
if (v2 != v1) {
|
||||
fprintf(test_out, "opal_dss.decrement failed for signed value\n");
|
||||
return(false);
|
||||
}
|
||||
|
||||
|
||||
dv.type = utype;
|
||||
dv.data = &u2;
|
||||
u1 = u2;
|
||||
|
||||
if (OPAL_SUCCESS != opal_dss.increment(&dv)) {
|
||||
fprintf(test_out, "opal_dss.increment returned error\n");
|
||||
return(false);
|
||||
}
|
||||
if (u2 != u1+1) {
|
||||
fprintf(test_out, "opal_dss.increment failed for unsigned value\n");
|
||||
return(false);
|
||||
}
|
||||
|
||||
if (OPAL_SUCCESS != opal_dss.decrement(&dv)) {
|
||||
fprintf(test_out, "opal_dss.decrement returned error\n");
|
||||
return(false);
|
||||
}
|
||||
if (u2 != u1) {
|
||||
fprintf(test_out, "opal_dss.decrement failed for unsigned value\n");
|
||||
return(false);
|
||||
}
|
||||
|
||||
|
||||
return (true);
|
||||
}
|
||||
|
||||
/*
|
||||
* INT16
|
||||
*/
|
||||
static bool test2(void)
|
||||
{
|
||||
int16_t v1, v2=100;
|
||||
uint16_t u1, u2=150;
|
||||
opal_data_type_t type=OPAL_INT16, utype=OPAL_UINT16;
|
||||
opal_dss_value_t dv;
|
||||
|
||||
dv.type = type;
|
||||
dv.data = &v2;
|
||||
v1 = v2;
|
||||
|
||||
if (OPAL_SUCCESS != opal_dss.increment(&dv)) {
|
||||
fprintf(test_out, "opal_dss.increment returned error\n");
|
||||
return(false);
|
||||
}
|
||||
if (v2 != v1+1) {
|
||||
fprintf(test_out, "opal_dss.increment failed for signed value\n");
|
||||
return(false);
|
||||
}
|
||||
|
||||
if (OPAL_SUCCESS != opal_dss.decrement(&dv)) {
|
||||
fprintf(test_out, "opal_dss.decrement returned error\n");
|
||||
return(false);
|
||||
}
|
||||
if (v2 != v1) {
|
||||
fprintf(test_out, "opal_dss.decrement failed for signed value\n");
|
||||
return(false);
|
||||
}
|
||||
|
||||
|
||||
dv.type = utype;
|
||||
dv.data = &u2;
|
||||
u1 = u2;
|
||||
|
||||
if (OPAL_SUCCESS != opal_dss.increment(&dv)) {
|
||||
fprintf(test_out, "opal_dss.increment returned error\n");
|
||||
return(false);
|
||||
}
|
||||
if (u2 != u1+1) {
|
||||
fprintf(test_out, "opal_dss.increment failed for unsigned value\n");
|
||||
return(false);
|
||||
}
|
||||
|
||||
if (OPAL_SUCCESS != opal_dss.decrement(&dv)) {
|
||||
fprintf(test_out, "opal_dss.decrement returned error\n");
|
||||
return(false);
|
||||
}
|
||||
if (u2 != u1) {
|
||||
fprintf(test_out, "opal_dss.decrement failed for unsigned value\n");
|
||||
return(false);
|
||||
}
|
||||
|
||||
|
||||
return (true);
|
||||
}
|
||||
|
||||
/*
|
||||
* INT32
|
||||
*/
|
||||
static bool test3(void)
|
||||
{
|
||||
int32_t v1, v2=100;
|
||||
uint32_t u1, u2=150;
|
||||
opal_data_type_t type=OPAL_INT32, utype=OPAL_UINT32;
|
||||
opal_dss_value_t dv;
|
||||
|
||||
dv.type = type;
|
||||
dv.data = &v2;
|
||||
v1 = v2;
|
||||
|
||||
if (OPAL_SUCCESS != opal_dss.increment(&dv)) {
|
||||
fprintf(test_out, "opal_dss.increment returned error\n");
|
||||
return(false);
|
||||
}
|
||||
if (v2 != v1+1) {
|
||||
fprintf(test_out, "opal_dss.increment failed for signed value\n");
|
||||
return(false);
|
||||
}
|
||||
|
||||
if (OPAL_SUCCESS != opal_dss.decrement(&dv)) {
|
||||
fprintf(test_out, "opal_dss.decrement returned error\n");
|
||||
return(false);
|
||||
}
|
||||
if (v2 != v1) {
|
||||
fprintf(test_out, "opal_dss.decrement failed for signed value\n");
|
||||
return(false);
|
||||
}
|
||||
|
||||
|
||||
dv.type = utype;
|
||||
dv.data = &u2;
|
||||
u1 = u2;
|
||||
|
||||
if (OPAL_SUCCESS != opal_dss.increment(&dv)) {
|
||||
fprintf(test_out, "opal_dss.increment returned error\n");
|
||||
return(false);
|
||||
}
|
||||
if (u2 != u1+1) {
|
||||
fprintf(test_out, "opal_dss.increment failed for unsigned value\n");
|
||||
return(false);
|
||||
}
|
||||
|
||||
if (OPAL_SUCCESS != opal_dss.decrement(&dv)) {
|
||||
fprintf(test_out, "opal_dss.decrement returned error\n");
|
||||
return(false);
|
||||
}
|
||||
if (u2 != u1) {
|
||||
fprintf(test_out, "opal_dss.decrement failed for unsigned value\n");
|
||||
return(false);
|
||||
}
|
||||
|
||||
|
||||
return (true);
|
||||
}
|
||||
|
||||
/*
|
||||
* INT64
|
||||
*/
|
||||
static bool test4(void)
|
||||
{
|
||||
int64_t v1, v2=100;
|
||||
uint64_t u1, u2=150;
|
||||
opal_data_type_t type=OPAL_INT64, utype=OPAL_UINT64;
|
||||
opal_dss_value_t dv;
|
||||
|
||||
dv.type = type;
|
||||
dv.data = &v2;
|
||||
v1 = v2;
|
||||
|
||||
if (OPAL_SUCCESS != opal_dss.increment(&dv)) {
|
||||
fprintf(test_out, "opal_dss.increment returned error\n");
|
||||
return(false);
|
||||
}
|
||||
if (v2 != v1+1) {
|
||||
fprintf(test_out, "opal_dss.increment failed for signed value\n");
|
||||
return(false);
|
||||
}
|
||||
|
||||
if (OPAL_SUCCESS != opal_dss.decrement(&dv)) {
|
||||
fprintf(test_out, "opal_dss.decrement returned error\n");
|
||||
return(false);
|
||||
}
|
||||
if (v2 != v1) {
|
||||
fprintf(test_out, "opal_dss.decrement failed for signed value\n");
|
||||
return(false);
|
||||
}
|
||||
|
||||
|
||||
dv.type = utype;
|
||||
dv.data = &u2;
|
||||
u1 = u2;
|
||||
|
||||
if (OPAL_SUCCESS != opal_dss.increment(&dv)) {
|
||||
fprintf(test_out, "opal_dss.increment returned error\n");
|
||||
return(false);
|
||||
}
|
||||
if (u2 != u1+1) {
|
||||
fprintf(test_out, "opal_dss.increment failed for unsigned value\n");
|
||||
return(false);
|
||||
}
|
||||
|
||||
if (OPAL_SUCCESS != opal_dss.decrement(&dv)) {
|
||||
fprintf(test_out, "opal_dss.decrement returned error\n");
|
||||
return(false);
|
||||
}
|
||||
if (u2 != u1) {
|
||||
fprintf(test_out, "opal_dss.decrement failed for unsigned value\n");
|
||||
return(false);
|
||||
}
|
||||
|
||||
|
||||
return (true);
|
||||
}
|
||||
|
||||
/*
|
||||
* INT
|
||||
*/
|
||||
static bool test5(void)
|
||||
{
|
||||
int v1, v2=100;
|
||||
uint u1, u2=150;
|
||||
opal_data_type_t type=OPAL_INT, utype=OPAL_UINT;
|
||||
opal_dss_value_t dv;
|
||||
|
||||
dv.type = type;
|
||||
dv.data = &v2;
|
||||
v1 = v2;
|
||||
|
||||
if (OPAL_SUCCESS != opal_dss.increment(&dv)) {
|
||||
fprintf(test_out, "opal_dss.increment returned error\n");
|
||||
return(false);
|
||||
}
|
||||
if (v2 != v1+1) {
|
||||
fprintf(test_out, "opal_dss.increment failed for signed value\n");
|
||||
return(false);
|
||||
}
|
||||
|
||||
if (OPAL_SUCCESS != opal_dss.decrement(&dv)) {
|
||||
fprintf(test_out, "opal_dss.decrement returned error\n");
|
||||
return(false);
|
||||
}
|
||||
if (v2 != v1) {
|
||||
fprintf(test_out, "opal_dss.decrement failed for signed value\n");
|
||||
return(false);
|
||||
}
|
||||
|
||||
|
||||
dv.type = utype;
|
||||
dv.data = &u2;
|
||||
u1 = u2;
|
||||
|
||||
if (OPAL_SUCCESS != opal_dss.increment(&dv)) {
|
||||
fprintf(test_out, "opal_dss.increment returned error\n");
|
||||
return(false);
|
||||
}
|
||||
if (u2 != u1+1) {
|
||||
fprintf(test_out, "opal_dss.increment failed for unsigned value\n");
|
||||
return(false);
|
||||
}
|
||||
|
||||
if (OPAL_SUCCESS != opal_dss.decrement(&dv)) {
|
||||
fprintf(test_out, "opal_dss.decrement returned error\n");
|
||||
return(false);
|
||||
}
|
||||
if (u2 != u1) {
|
||||
fprintf(test_out, "opal_dss.decrement failed for unsigned value\n");
|
||||
return(false);
|
||||
}
|
||||
|
||||
return (true);
|
||||
}
|
||||
|
||||
/*
|
||||
* STRING
|
||||
*/
|
||||
static bool test6(void)
|
||||
{
|
||||
char *string1="This is a short string";
|
||||
opal_dss_value_t dv;
|
||||
|
||||
dv.type = OPAL_STRING;
|
||||
dv.data = string1;
|
||||
|
||||
if (OPAL_ERR_OPERATION_UNSUPPORTED != opal_dss.increment(&dv)) {
|
||||
fprintf(test_out, "opal_dss.increment failed to return correct error\n");
|
||||
return(false);
|
||||
}
|
||||
|
||||
return (true);
|
||||
}
|
||||
|
||||
/*
|
||||
* BOOL
|
||||
*/
|
||||
static bool test7(void)
|
||||
{
|
||||
bool v2=true;
|
||||
opal_dss_value_t dv;
|
||||
|
||||
dv.type = OPAL_BOOL;
|
||||
dv.data = &v2;
|
||||
|
||||
if (OPAL_ERR_OPERATION_UNSUPPORTED != opal_dss.increment(&dv)) {
|
||||
fprintf(test_out, "opal_dss.increment failed to return correct error\n");
|
||||
return(false);
|
||||
}
|
||||
|
||||
return (true);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* SIZE
|
||||
*/
|
||||
static bool test8(void)
|
||||
{
|
||||
size_t v1, v2=100;
|
||||
opal_data_type_t type=OPAL_SIZE;
|
||||
opal_dss_value_t dv;
|
||||
|
||||
dv.type = type;
|
||||
dv.data = &v2;
|
||||
v1 = v2;
|
||||
|
||||
if (OPAL_SUCCESS != opal_dss.increment(&dv)) {
|
||||
fprintf(test_out, "opal_dss.increment returned error\n");
|
||||
return(false);
|
||||
}
|
||||
if (v2 != v1+1) {
|
||||
fprintf(test_out, "opal_dss.increment failed for size value\n");
|
||||
return(false);
|
||||
}
|
||||
|
||||
if (OPAL_SUCCESS != opal_dss.decrement(&dv)) {
|
||||
fprintf(test_out, "opal_dss.decrement returned error\n");
|
||||
return(false);
|
||||
}
|
||||
if (v2 != v1) {
|
||||
fprintf(test_out, "opal_dss.decrement failed for size value\n");
|
||||
return(false);
|
||||
}
|
||||
|
||||
return (true);
|
||||
}
|
||||
|
||||
/*
|
||||
* PID
|
||||
*/
|
||||
static bool test9(void)
|
||||
{
|
||||
pid_t v1, v2=100;
|
||||
opal_data_type_t type=OPAL_PID;
|
||||
opal_dss_value_t dv;
|
||||
|
||||
dv.type = type;
|
||||
dv.data = &v2;
|
||||
v1 = v2;
|
||||
|
||||
if (OPAL_SUCCESS != opal_dss.increment(&dv)) {
|
||||
fprintf(test_out, "opal_dss.increment returned error\n");
|
||||
return(false);
|
||||
}
|
||||
if (v2 != v1+1) {
|
||||
fprintf(test_out, "opal_dss.increment failed for pid value\n");
|
||||
return(false);
|
||||
}
|
||||
|
||||
if (OPAL_SUCCESS != opal_dss.decrement(&dv)) {
|
||||
fprintf(test_out, "opal_dss.decrement returned error\n");
|
||||
return(false);
|
||||
}
|
||||
if (v2 != v1) {
|
||||
fprintf(test_out, "opal_dss.decrement failed for pid value\n");
|
||||
return(false);
|
||||
}
|
||||
|
||||
return (true);
|
||||
}
|
||||
|
||||
/*
|
||||
* DATA TYPE
|
||||
*/
|
||||
static bool test11(void)
|
||||
{
|
||||
opal_data_type_t v1, v2=100;
|
||||
opal_data_type_t type=OPAL_DATA_TYPE;
|
||||
opal_dss_value_t dv;
|
||||
|
||||
dv.type = type;
|
||||
dv.data = &v2;
|
||||
v1 = v2;
|
||||
|
||||
if (OPAL_SUCCESS != opal_dss.increment(&dv)) {
|
||||
fprintf(test_out, "opal_dss.increment returned error\n");
|
||||
return(false);
|
||||
}
|
||||
if (v2 != v1+1) {
|
||||
fprintf(test_out, "opal_dss.increment failed for data type value\n");
|
||||
return(false);
|
||||
}
|
||||
|
||||
if (OPAL_SUCCESS != opal_dss.decrement(&dv)) {
|
||||
fprintf(test_out, "opal_dss.decrement returned error\n");
|
||||
return(false);
|
||||
}
|
||||
if (v2 != v1) {
|
||||
fprintf(test_out, "opal_dss.decrement failed for data type value\n");
|
||||
return(false);
|
||||
}
|
||||
|
||||
return (true);
|
||||
}
|
||||
|
||||
/**
|
||||
* OPAL_BYTE_OBJECT
|
||||
*/
|
||||
|
||||
static bool test12(void)
|
||||
{
|
||||
size_t i;
|
||||
opal_byte_object_t v2;
|
||||
opal_dss_value_t dv;
|
||||
|
||||
v2.size = 20;
|
||||
v2.bytes = (uint8_t*)malloc(v2.size);
|
||||
for (i=0; i<v2.size; i++) v2.bytes[i] = i;
|
||||
|
||||
dv.type = OPAL_BYTE_OBJECT;
|
||||
dv.data = &v2;
|
||||
|
||||
if (OPAL_ERR_OPERATION_UNSUPPORTED != opal_dss.increment(&dv)) {
|
||||
fprintf(test_out, "opal_dss.increment failed to return correct error\n");
|
||||
return(false);
|
||||
}
|
||||
|
||||
return (true);
|
||||
}
|
Загрузка…
x
Ссылка в новой задаче
Block a user