From 597a16e79e50f4a3a4f2294f66f9a9f0473c8af1 Mon Sep 17 00:00:00 2001 From: MihailRis Date: Wed, 2 Oct 2024 22:29:14 +0300 Subject: [PATCH] update block-properties docs --- doc/en/block-properties.md | 10 ++++++++++ doc/ru/block-properties.md | 12 ++++++++++++ 2 files changed, 22 insertions(+) diff --git a/doc/en/block-properties.md b/doc/en/block-properties.md index 4d235d1b..cef58a9a 100644 --- a/doc/en/block-properties.md +++ b/doc/en/block-properties.md @@ -156,6 +156,16 @@ Block fields are declared in the following format: } ``` +In addition to `type` and `length`, the `convert-strategy` parameter determines the value conversion strategy when narrowing the data type. + +The parameter takes one of two values: +- `reset` - a value that does not exists in the new range will be reset to 0 +- `clamp` - the value will be reduced to the closest one in the new range + +Example: the number 231 when changing the field type from int16 to int8: +- in `reset` mode will turn into 0 +- in `clamp` mode will turn into 127 + Available data types: | Type | Size | Description | diff --git a/doc/ru/block-properties.md b/doc/ru/block-properties.md index 725e2e67..8b2055e4 100644 --- a/doc/ru/block-properties.md +++ b/doc/ru/block-properties.md @@ -159,6 +159,18 @@ } ``` +Кроме `type` и `length` доступен параметр `convert-strategy` определяющий +стратегию конвертации значения при сужении типа данных. + +Параметр принимает одно из двух значений: +- `reset` - значение, не попадающее в новый диапазон, будет сброшено до 0 +- `clamp` - значение будет сведено к ближайшему в новом диапазоне + +Пример: число 231 при изменении типа поля с int16 до int8: +- в режиме `reset` превратится в 0 +- в режиме `clamp` превратится в 127 + + Доступные типы данных: | Тип | Размер | Описание |