Rate This Document
Findability
Accuracy
Completeness
Readability

Min

The function interface declaration is as follows:

HmppResult HMPPS_Min_64s(const int64_t *src, int32_t len, int64_t *min);

HmppResult HMPPS_Min_decimal(const HmppDecimal128 *src, int32_t len, HmppDecimal128 *min);

HmppResult HMPPS_Min_varchar(const varchar *src, const int32_t *offset, int32_t len, varchar *min, int32_t *minlen);

Parameters

Parameter

Description

Value Range

Input/Output

src

Pointer to the source vector

The value cannot be NULL.

Input

len

Vector length

(0,INT_MAX]

Input

offset

Pointer to the offset address of the substring

The value cannot be NULL.

Input

min

Pointer to the result

The value cannot be NULL.

Output

minlen

Pointer to the length of the result string

The value cannot be NULL.

Output

When using the HMPPS_Min_varchar function, ensure sufficient memory for min to prevent segmentation faults. You are advised to allocate the same memory size for min as that for src.

Return Value

  • Success: HMPP_STS_NO_ERR
  • Failure: An error code is returned.

Error Codes

Error Code

Description

HMPP_STS_NULL_PTR_ERR

The value of src, min, minlen, or offset is NULL.

HMPP_STS_SIZE_ERR

The value of len is less than or equal to 0.

Example

#include <stdio.h>
#include "hmpp.h"
#define BUFFER_SIZE_T 10

int main() {
    int64_t src[BUFFER_SIZE_T] = {3, 6, 2, 8, 3, 15, 56, 31, 1, 23};
    int64_t min;
    HmppResult result = HMPPS_Min_64s(src, BUFFER_SIZE_T, &min);
    printf("result = %d  ", result);
    if (result != HMPP_STS_NO_ERR) {
        return 0;
    }
    printf("min = %ld\n", max);
}

Output:

result = 0  min = 1