/**
 * The MIT License (MIT)
 *
 * Copyright (c) 2018-2019 Erik Moqvist
 *
 * Permission is hereby granted, free of charge, to any person
 * obtaining a copy of this software and associated documentation
 * files (the "Software"), to deal in the Software without
 * restriction, including without limitation the rights to use, copy,
 * modify, merge, publish, distribute, sublicense, and/or sell copies
 * of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be
 * included in all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */

/**
 * This file was generated by cantools version 36.5.0 Sat Nov 13 00:14:30 2021.
 */

#include <string.h>

#include "ecarx_loc.h"

static inline uint8_t pack_left_shift_u8(
    uint8_t value,
    uint8_t shift,
    uint8_t mask)
{
    return (uint8_t)((uint8_t)(value << shift) & mask);
}

static inline uint8_t pack_left_shift_u16(
    uint16_t value,
    uint8_t shift,
    uint8_t mask)
{
    return (uint8_t)((uint8_t)(value << shift) & mask);
}

static inline uint8_t pack_left_shift_u32(
    uint32_t value,
    uint8_t shift,
    uint8_t mask)
{
    return (uint8_t)((uint8_t)(value << shift) & mask);
}

static inline uint8_t pack_left_shift_u64(
    uint64_t value,
    uint8_t shift,
    uint8_t mask)
{
    return (uint8_t)((uint8_t)(value << shift) & mask);
}

static inline uint8_t pack_right_shift_u16(
    uint16_t value,
    uint8_t shift,
    uint8_t mask)
{
    return (uint8_t)((uint8_t)(value >> shift) & mask);
}

static inline uint8_t pack_right_shift_u32(
    uint32_t value,
    uint8_t shift,
    uint8_t mask)
{
    return (uint8_t)((uint8_t)(value >> shift) & mask);
}

static inline uint8_t pack_right_shift_u64(
    uint64_t value,
    uint8_t shift,
    uint8_t mask)
{
    return (uint8_t)((uint8_t)(value >> shift) & mask);
}

static inline uint16_t unpack_left_shift_u16(
    uint8_t value,
    uint8_t shift,
    uint8_t mask)
{
    return (uint16_t)((uint16_t)(value & mask) << shift);
}

static inline uint32_t unpack_left_shift_u32(
    uint8_t value,
    uint8_t shift,
    uint8_t mask)
{
    return (uint32_t)((uint32_t)(value & mask) << shift);
}

static inline uint64_t unpack_left_shift_u64(
    uint8_t value,
    uint8_t shift,
    uint8_t mask)
{
    return (uint64_t)((uint64_t)(value & mask) << shift);
}

static inline uint8_t unpack_right_shift_u8(
    uint8_t value,
    uint8_t shift,
    uint8_t mask)
{
    return (uint8_t)((uint8_t)(value & mask) >> shift);
}

static inline uint16_t unpack_right_shift_u16(
    uint8_t value,
    uint8_t shift,
    uint8_t mask)
{
    return (uint16_t)((uint16_t)(value & mask) >> shift);
}

static inline uint32_t unpack_right_shift_u32(
    uint8_t value,
    uint8_t shift,
    uint8_t mask)
{
    return (uint32_t)((uint32_t)(value & mask) >> shift);
}

static inline uint64_t unpack_right_shift_u64(
    uint8_t value,
    uint8_t shift,
    uint8_t mask)
{
    return (uint64_t)((uint64_t)(value & mask) >> shift);
}

int ecarx_loc_localization_result_std_sts_pack(
    uint8_t *dst_p,
    const struct ecarx_loc_localization_result_std_sts_t *src_p,
    size_t size)
{
    uint16_t localization_acceleration_std;
    uint16_t localization_altitude_std;
    uint16_t localization_pitch_std;
    uint16_t localization_roll_std;
    uint16_t localization_yaw_std;
    uint32_t localization_latitude_std;
    uint32_t localization_longitude_std;

    if (size < 64u) {
        return (-EINVAL);
    }

    memset(&dst_p[0], 0, 64);

    localization_acceleration_std = (uint16_t)src_p->localization_acceleration_std;
    dst_p[0] |= pack_right_shift_u16(localization_acceleration_std, 8u, 0xffu);
    dst_p[1] |= pack_left_shift_u16(localization_acceleration_std, 0u, 0xffu);
    localization_altitude_std = (uint16_t)src_p->localization_altitude_std;
    dst_p[2] |= pack_right_shift_u16(localization_altitude_std, 8u, 0xffu);
    dst_p[3] |= pack_left_shift_u16(localization_altitude_std, 0u, 0xffu);
    dst_p[4] |= pack_left_shift_u8(src_p->localization_init_status, 0u, 0xffu);
    dst_p[5] |= pack_left_shift_u8(src_p->localization_status, 0u, 0xffu);
    localization_latitude_std = (uint32_t)src_p->localization_latitude_std;
    dst_p[6] |= pack_right_shift_u32(localization_latitude_std, 24u, 0xffu);
    dst_p[7] |= pack_right_shift_u32(localization_latitude_std, 16u, 0xffu);
    dst_p[8] |= pack_right_shift_u32(localization_latitude_std, 8u, 0xffu);
    dst_p[9] |= pack_left_shift_u32(localization_latitude_std, 0u, 0xffu);
    localization_longitude_std = (uint32_t)src_p->localization_longitude_std;
    dst_p[10] |= pack_right_shift_u32(localization_longitude_std, 24u, 0xffu);
    dst_p[11] |= pack_right_shift_u32(localization_longitude_std, 16u, 0xffu);
    dst_p[12] |= pack_right_shift_u32(localization_longitude_std, 8u, 0xffu);
    dst_p[13] |= pack_left_shift_u32(localization_longitude_std, 0u, 0xffu);
    localization_pitch_std = (uint16_t)src_p->localization_pitch_std;
    dst_p[14] |= pack_right_shift_u16(localization_pitch_std, 8u, 0xffu);
    dst_p[15] |= pack_left_shift_u16(localization_pitch_std, 0u, 0xffu);
    localization_roll_std = (uint16_t)src_p->localization_roll_std;
    dst_p[16] |= pack_right_shift_u16(localization_roll_std, 8u, 0xffu);
    dst_p[17] |= pack_left_shift_u16(localization_roll_std, 0u, 0xffu);
    dst_p[18] |= pack_right_shift_u16(src_p->localization_velocity_std, 8u, 0xffu);
    dst_p[19] |= pack_left_shift_u16(src_p->localization_velocity_std, 0u, 0xffu);
    localization_yaw_std = (uint16_t)src_p->localization_yaw_std;
    dst_p[20] |= pack_right_shift_u16(localization_yaw_std, 8u, 0xffu);
    dst_p[21] |= pack_left_shift_u16(localization_yaw_std, 0u, 0xffu);

    return (64);
}

int ecarx_loc_localization_result_std_sts_unpack(
    struct ecarx_loc_localization_result_std_sts_t *dst_p,
    const uint8_t *src_p,
    size_t size)
{
    uint16_t localization_acceleration_std;
    uint16_t localization_altitude_std;
    uint16_t localization_pitch_std;
    uint16_t localization_roll_std;
    uint16_t localization_yaw_std;
    uint32_t localization_latitude_std;
    uint32_t localization_longitude_std;

    if (size < 64u) {
        return (-EINVAL);
    }

    localization_acceleration_std = unpack_left_shift_u16(src_p[0], 8u, 0xffu);
    localization_acceleration_std |= unpack_right_shift_u16(src_p[1], 0u, 0xffu);
    dst_p->localization_acceleration_std = (int16_t)localization_acceleration_std;
    localization_altitude_std = unpack_left_shift_u16(src_p[2], 8u, 0xffu);
    localization_altitude_std |= unpack_right_shift_u16(src_p[3], 0u, 0xffu);
    dst_p->localization_altitude_std = (int16_t)localization_altitude_std;
    dst_p->localization_init_status = unpack_right_shift_u8(src_p[4], 0u, 0xffu);
    dst_p->localization_status = unpack_right_shift_u8(src_p[5], 0u, 0xffu);
    localization_latitude_std = unpack_left_shift_u32(src_p[6], 24u, 0xffu);
    localization_latitude_std |= unpack_left_shift_u32(src_p[7], 16u, 0xffu);
    localization_latitude_std |= unpack_left_shift_u32(src_p[8], 8u, 0xffu);
    localization_latitude_std |= unpack_right_shift_u32(src_p[9], 0u, 0xffu);
    dst_p->localization_latitude_std = (int32_t)localization_latitude_std;
    localization_longitude_std = unpack_left_shift_u32(src_p[10], 24u, 0xffu);
    localization_longitude_std |= unpack_left_shift_u32(src_p[11], 16u, 0xffu);
    localization_longitude_std |= unpack_left_shift_u32(src_p[12], 8u, 0xffu);
    localization_longitude_std |= unpack_right_shift_u32(src_p[13], 0u, 0xffu);
    dst_p->localization_longitude_std = (int32_t)localization_longitude_std;
    localization_pitch_std = unpack_left_shift_u16(src_p[14], 8u, 0xffu);
    localization_pitch_std |= unpack_right_shift_u16(src_p[15], 0u, 0xffu);
    dst_p->localization_pitch_std = (int16_t)localization_pitch_std;
    localization_roll_std = unpack_left_shift_u16(src_p[16], 8u, 0xffu);
    localization_roll_std |= unpack_right_shift_u16(src_p[17], 0u, 0xffu);
    dst_p->localization_roll_std = (int16_t)localization_roll_std;
    dst_p->localization_velocity_std = unpack_left_shift_u16(src_p[18], 8u, 0xffu);
    dst_p->localization_velocity_std |= unpack_right_shift_u16(src_p[19], 0u, 0xffu);
    localization_yaw_std = unpack_left_shift_u16(src_p[20], 8u, 0xffu);
    localization_yaw_std |= unpack_right_shift_u16(src_p[21], 0u, 0xffu);
    dst_p->localization_yaw_std = (int16_t)localization_yaw_std;

    return (0);
}

int16_t ecarx_loc_localization_result_std_sts_localization_acceleration_std_encode(double value)
{
    return (int16_t)(value / 0.001);
}

double ecarx_loc_localization_result_std_sts_localization_acceleration_std_decode(int16_t value)
{
    return ((double)value * 0.001);
}

bool ecarx_loc_localization_result_std_sts_localization_acceleration_std_is_in_range(int16_t value)
{
    (void)value;

    return (true);
}

int16_t ecarx_loc_localization_result_std_sts_localization_altitude_std_encode(double value)
{
    return (int16_t)(value / 0.01);
}

double ecarx_loc_localization_result_std_sts_localization_altitude_std_decode(int16_t value)
{
    return ((double)value * 0.01);
}

bool ecarx_loc_localization_result_std_sts_localization_altitude_std_is_in_range(int16_t value)
{
    (void)value;

    return (true);
}

uint8_t ecarx_loc_localization_result_std_sts_localization_init_status_encode(double value)
{
    return (uint8_t)(value);
}

double ecarx_loc_localization_result_std_sts_localization_init_status_decode(uint8_t value)
{
    return ((double)value);
}

bool ecarx_loc_localization_result_std_sts_localization_init_status_is_in_range(uint8_t value)
{
    (void)value;

    return (true);
}

uint8_t ecarx_loc_localization_result_std_sts_localization_status_encode(double value)
{
    return (uint8_t)(value);
}

double ecarx_loc_localization_result_std_sts_localization_status_decode(uint8_t value)
{
    return ((double)value);
}

bool ecarx_loc_localization_result_std_sts_localization_status_is_in_range(uint8_t value)
{
    (void)value;

    return (true);
}

int32_t ecarx_loc_localization_result_std_sts_localization_latitude_std_encode(double value)
{
    return (int32_t)(value / 1E-7);
}

double ecarx_loc_localization_result_std_sts_localization_latitude_std_decode(int32_t value)
{
    return ((double)value * 1E-7);
}

bool ecarx_loc_localization_result_std_sts_localization_latitude_std_is_in_range(int32_t value)
{
    (void)value;

    return (true);
}

int32_t ecarx_loc_localization_result_std_sts_localization_longitude_std_encode(double value)
{
    return (int32_t)(value / 1E-7);
}

double ecarx_loc_localization_result_std_sts_localization_longitude_std_decode(int32_t value)
{
    return ((double)value * 1E-7);
}

bool ecarx_loc_localization_result_std_sts_localization_longitude_std_is_in_range(int32_t value)
{
    (void)value;

    return (true);
}

int16_t ecarx_loc_localization_result_std_sts_localization_pitch_std_encode(double value)
{
    return (int16_t)(value / 0.001);
}

double ecarx_loc_localization_result_std_sts_localization_pitch_std_decode(int16_t value)
{
    return ((double)value * 0.001);
}

bool ecarx_loc_localization_result_std_sts_localization_pitch_std_is_in_range(int16_t value)
{
    (void)value;

    return (true);
}

int16_t ecarx_loc_localization_result_std_sts_localization_roll_std_encode(double value)
{
    return (int16_t)(value / 0.001);
}

double ecarx_loc_localization_result_std_sts_localization_roll_std_decode(int16_t value)
{
    return ((double)value * 0.001);
}

bool ecarx_loc_localization_result_std_sts_localization_roll_std_is_in_range(int16_t value)
{
    (void)value;

    return (true);
}

uint16_t ecarx_loc_localization_result_std_sts_localization_velocity_std_encode(double value)
{
    return (uint16_t)(value / 0.01);
}

double ecarx_loc_localization_result_std_sts_localization_velocity_std_decode(uint16_t value)
{
    return ((double)value * 0.01);
}

bool ecarx_loc_localization_result_std_sts_localization_velocity_std_is_in_range(uint16_t value)
{
    (void)value;

    return (true);
}

int16_t ecarx_loc_localization_result_std_sts_localization_yaw_std_encode(double value)
{
    return (int16_t)(value / 0.001);
}

double ecarx_loc_localization_result_std_sts_localization_yaw_std_decode(int16_t value)
{
    return ((double)value * 0.001);
}

bool ecarx_loc_localization_result_std_sts_localization_yaw_std_is_in_range(int16_t value)
{
    (void)value;

    return (true);
}

int ecarx_loc_localization_result_pack(
    uint8_t *dst_p,
    const struct ecarx_loc_localization_result_t *src_p,
    size_t size)
{
    uint16_t localization_acceleration;
    uint16_t localization_pitch;
    uint16_t localization_roll;
    uint16_t localization_yaw;
    uint32_t localization_altitude;
    uint64_t localization_latitude;
    uint64_t localization_longitude;

    if (size < 64u) {
        return (-EINVAL);
    }

    memset(&dst_p[0], 0, 64);

    localization_acceleration = (uint16_t)src_p->localization_acceleration;
    dst_p[0] |= pack_right_shift_u16(localization_acceleration, 8u, 0xffu);
    dst_p[1] |= pack_left_shift_u16(localization_acceleration, 0u, 0xffu);
    localization_altitude = (uint32_t)src_p->localization_altitude;
    dst_p[2] |= pack_right_shift_u32(localization_altitude, 24u, 0xffu);
    dst_p[3] |= pack_right_shift_u32(localization_altitude, 16u, 0xffu);
    dst_p[4] |= pack_right_shift_u32(localization_altitude, 8u, 0xffu);
    dst_p[5] |= pack_left_shift_u32(localization_altitude, 0u, 0xffu);
    dst_p[6] |= pack_left_shift_u8(src_p->localization_confidence, 0u, 0xffu);
    localization_latitude = (uint64_t)src_p->localization_latitude;
    dst_p[8] |= pack_right_shift_u64(localization_latitude, 40u, 0xffu);
    dst_p[9] |= pack_right_shift_u64(localization_latitude, 32u, 0xffu);
    dst_p[10] |= pack_right_shift_u64(localization_latitude, 24u, 0xffu);
    dst_p[11] |= pack_right_shift_u64(localization_latitude, 16u, 0xffu);
    dst_p[12] |= pack_right_shift_u64(localization_latitude, 8u, 0xffu);
    dst_p[13] |= pack_left_shift_u64(localization_latitude, 0u, 0xffu);
    localization_longitude = (uint64_t)src_p->localization_longitude;
    dst_p[14] |= pack_right_shift_u64(localization_longitude, 40u, 0xffu);
    dst_p[15] |= pack_right_shift_u64(localization_longitude, 32u, 0xffu);
    dst_p[16] |= pack_right_shift_u64(localization_longitude, 24u, 0xffu);
    dst_p[17] |= pack_right_shift_u64(localization_longitude, 16u, 0xffu);
    dst_p[18] |= pack_right_shift_u64(localization_longitude, 8u, 0xffu);
    dst_p[19] |= pack_left_shift_u64(localization_longitude, 0u, 0xffu);
    localization_pitch = (uint16_t)src_p->localization_pitch;
    dst_p[20] |= pack_right_shift_u16(localization_pitch, 8u, 0xffu);
    dst_p[21] |= pack_left_shift_u16(localization_pitch, 0u, 0xffu);
    localization_roll = (uint16_t)src_p->localization_roll;
    dst_p[22] |= pack_right_shift_u16(localization_roll, 8u, 0xffu);
    dst_p[23] |= pack_left_shift_u16(localization_roll, 0u, 0xffu);
    dst_p[24] |= pack_right_shift_u16(src_p->localization_velocity, 8u, 0xffu);
    dst_p[25] |= pack_left_shift_u16(src_p->localization_velocity, 0u, 0xffu);
    localization_yaw = (uint16_t)src_p->localization_yaw;
    dst_p[26] |= pack_right_shift_u16(localization_yaw, 8u, 0xffu);
    dst_p[27] |= pack_left_shift_u16(localization_yaw, 0u, 0xffu);

    return (64);
}

int ecarx_loc_localization_result_unpack(
    struct ecarx_loc_localization_result_t *dst_p,
    const uint8_t *src_p,
    size_t size)
{
    uint16_t localization_acceleration;
    uint16_t localization_pitch;
    uint16_t localization_roll;
    uint16_t localization_yaw;
    uint32_t localization_altitude;
    uint64_t localization_latitude;
    uint64_t localization_longitude;

    if (size < 64u) {
        return (-EINVAL);
    }

    localization_acceleration = unpack_left_shift_u16(src_p[0], 8u, 0xffu);
    localization_acceleration |= unpack_right_shift_u16(src_p[1], 0u, 0xffu);
    dst_p->localization_acceleration = (int16_t)localization_acceleration;
    localization_altitude = unpack_left_shift_u32(src_p[2], 24u, 0xffu);
    localization_altitude |= unpack_left_shift_u32(src_p[3], 16u, 0xffu);
    localization_altitude |= unpack_left_shift_u32(src_p[4], 8u, 0xffu);
    localization_altitude |= unpack_right_shift_u32(src_p[5], 0u, 0xffu);
    dst_p->localization_altitude = (int32_t)localization_altitude;
    dst_p->localization_confidence = unpack_right_shift_u8(src_p[6], 0u, 0xffu);
    localization_latitude = unpack_left_shift_u64(src_p[8], 40u, 0xffu);
    localization_latitude |= unpack_left_shift_u64(src_p[9], 32u, 0xffu);
    localization_latitude |= unpack_left_shift_u64(src_p[10], 24u, 0xffu);
    localization_latitude |= unpack_left_shift_u64(src_p[11], 16u, 0xffu);
    localization_latitude |= unpack_left_shift_u64(src_p[12], 8u, 0xffu);
    localization_latitude |= unpack_right_shift_u64(src_p[13], 0u, 0xffu);

    if ((localization_latitude & (1ull << 47)) != 0ull) {
        localization_latitude |= 0xffff000000000000ull;
    }

    dst_p->localization_latitude = (int64_t)localization_latitude;
    localization_longitude = unpack_left_shift_u64(src_p[14], 40u, 0xffu);
    localization_longitude |= unpack_left_shift_u64(src_p[15], 32u, 0xffu);
    localization_longitude |= unpack_left_shift_u64(src_p[16], 24u, 0xffu);
    localization_longitude |= unpack_left_shift_u64(src_p[17], 16u, 0xffu);
    localization_longitude |= unpack_left_shift_u64(src_p[18], 8u, 0xffu);
    localization_longitude |= unpack_right_shift_u64(src_p[19], 0u, 0xffu);

    if ((localization_longitude & (1ull << 47)) != 0ull) {
        localization_longitude |= 0xffff000000000000ull;
    }

    dst_p->localization_longitude = (int64_t)localization_longitude;
    localization_pitch = unpack_left_shift_u16(src_p[20], 8u, 0xffu);
    localization_pitch |= unpack_right_shift_u16(src_p[21], 0u, 0xffu);
    dst_p->localization_pitch = (int16_t)localization_pitch;
    localization_roll = unpack_left_shift_u16(src_p[22], 8u, 0xffu);
    localization_roll |= unpack_right_shift_u16(src_p[23], 0u, 0xffu);
    dst_p->localization_roll = (int16_t)localization_roll;
    dst_p->localization_velocity = unpack_left_shift_u16(src_p[24], 8u, 0xffu);
    dst_p->localization_velocity |= unpack_right_shift_u16(src_p[25], 0u, 0xffu);
    localization_yaw = unpack_left_shift_u16(src_p[26], 8u, 0xffu);
    localization_yaw |= unpack_right_shift_u16(src_p[27], 0u, 0xffu);
    dst_p->localization_yaw = (int16_t)localization_yaw;

    return (0);
}

int16_t ecarx_loc_localization_result_localization_acceleration_encode(double value)
{
    return (int16_t)(value / 0.001);
}

double ecarx_loc_localization_result_localization_acceleration_decode(int16_t value)
{
    return ((double)value * 0.001);
}

bool ecarx_loc_localization_result_localization_acceleration_is_in_range(int16_t value)
{
    (void)value;

    return (true);
}

int32_t ecarx_loc_localization_result_localization_altitude_encode(double value)
{
    return (int32_t)(value / 0.001);
}

double ecarx_loc_localization_result_localization_altitude_decode(int32_t value)
{
    return ((double)value * 0.001);
}

bool ecarx_loc_localization_result_localization_altitude_is_in_range(int32_t value)
{
    (void)value;

    return (true);
}

uint8_t ecarx_loc_localization_result_localization_confidence_encode(double value)
{
    return (uint8_t)(value / 0.01);
}

double ecarx_loc_localization_result_localization_confidence_decode(uint8_t value)
{
    return ((double)value * 0.01);
}

bool ecarx_loc_localization_result_localization_confidence_is_in_range(uint8_t value)
{
    (void)value;

    return (true);
}

int64_t ecarx_loc_localization_result_localization_latitude_encode(double value)
{
    return (int64_t)(value / 1E-8);
}

double ecarx_loc_localization_result_localization_latitude_decode(int64_t value)
{
    return ((double)value * 1E-8);
}

bool ecarx_loc_localization_result_localization_latitude_is_in_range(int64_t value)
{
    return ((value >= -140737488355328ll) && (value <= 140737488355327ll));
}

int64_t ecarx_loc_localization_result_localization_longitude_encode(double value)
{
    return (int64_t)(value / 1E-8);
}

double ecarx_loc_localization_result_localization_longitude_decode(int64_t value)
{
    return ((double)value * 1E-8);
}

bool ecarx_loc_localization_result_localization_longitude_is_in_range(int64_t value)
{
    return ((value >= -140737488355328ll) && (value <= 140737488355327ll));
}

int16_t ecarx_loc_localization_result_localization_pitch_encode(double value)
{
    return (int16_t)(value / 0.001);
}

double ecarx_loc_localization_result_localization_pitch_decode(int16_t value)
{
    return ((double)value * 0.001);
}

bool ecarx_loc_localization_result_localization_pitch_is_in_range(int16_t value)
{
    (void)value;

    return (true);
}

int16_t ecarx_loc_localization_result_localization_roll_encode(double value)
{
    return (int16_t)(value / 0.001);
}

double ecarx_loc_localization_result_localization_roll_decode(int16_t value)
{
    return ((double)value * 0.001);
}

bool ecarx_loc_localization_result_localization_roll_is_in_range(int16_t value)
{
    (void)value;

    return (true);
}

uint16_t ecarx_loc_localization_result_localization_velocity_encode(double value)
{
    return (uint16_t)(value / 0.01);
}

double ecarx_loc_localization_result_localization_velocity_decode(uint16_t value)
{
    return ((double)value * 0.01);
}

bool ecarx_loc_localization_result_localization_velocity_is_in_range(uint16_t value)
{
    (void)value;

    return (true);
}

int16_t ecarx_loc_localization_result_localization_yaw_encode(double value)
{
    return (int16_t)(value / 0.001);
}

double ecarx_loc_localization_result_localization_yaw_decode(int16_t value)
{
    return ((double)value * 0.001);
}

bool ecarx_loc_localization_result_localization_yaw_is_in_range(int16_t value)
{
    (void)value;

    return (true);
}

int ecarx_loc_localization_timestamp_pack(
    uint8_t *dst_p,
    const struct ecarx_loc_localization_timestamp_t *src_p,
    size_t size)
{
    if (size < 64u) {
        return (-EINVAL);
    }

    memset(&dst_p[0], 0, 64);

    dst_p[0] |= pack_right_shift_u64(src_p->localization_timestamp, 56u, 0xffu);
    dst_p[1] |= pack_right_shift_u64(src_p->localization_timestamp, 48u, 0xffu);
    dst_p[2] |= pack_right_shift_u64(src_p->localization_timestamp, 40u, 0xffu);
    dst_p[3] |= pack_right_shift_u64(src_p->localization_timestamp, 32u, 0xffu);
    dst_p[4] |= pack_right_shift_u64(src_p->localization_timestamp, 24u, 0xffu);
    dst_p[5] |= pack_right_shift_u64(src_p->localization_timestamp, 16u, 0xffu);
    dst_p[6] |= pack_right_shift_u64(src_p->localization_timestamp, 8u, 0xffu);
    dst_p[7] |= pack_left_shift_u64(src_p->localization_timestamp, 0u, 0xffu);

    return (64);
}

int ecarx_loc_localization_timestamp_unpack(
    struct ecarx_loc_localization_timestamp_t *dst_p,
    const uint8_t *src_p,
    size_t size)
{
    if (size < 64u) {
        return (-EINVAL);
    }

    dst_p->localization_timestamp = unpack_left_shift_u64(src_p[0], 56u, 0xffu);
    dst_p->localization_timestamp |= unpack_left_shift_u64(src_p[1], 48u, 0xffu);
    dst_p->localization_timestamp |= unpack_left_shift_u64(src_p[2], 40u, 0xffu);
    dst_p->localization_timestamp |= unpack_left_shift_u64(src_p[3], 32u, 0xffu);
    dst_p->localization_timestamp |= unpack_left_shift_u64(src_p[4], 24u, 0xffu);
    dst_p->localization_timestamp |= unpack_left_shift_u64(src_p[5], 16u, 0xffu);
    dst_p->localization_timestamp |= unpack_left_shift_u64(src_p[6], 8u, 0xffu);
    dst_p->localization_timestamp |= unpack_right_shift_u64(src_p[7], 0u, 0xffu);

    return (0);
}

uint64_t ecarx_loc_localization_timestamp_localization_timestamp_encode(double value)
{
    return (uint64_t)(value / 0.01);
}

double ecarx_loc_localization_timestamp_localization_timestamp_decode(uint64_t value)
{
    return ((double)value * 0.01);
}

bool ecarx_loc_localization_timestamp_localization_timestamp_is_in_range(uint64_t value)
{
    (void)value;

    return (true);
}