Fixed alignment of value fields in `LLamaModelMetadataOverride`
This commit is contained in:
parent
3fc0f34cbe
commit
2cded1b296
|
@ -269,7 +269,7 @@ namespace LLama.Abstractions
|
|||
dest.FloatValue = _valueFloat;
|
||||
break;
|
||||
case LLamaModelKvOverrideType.LLAMA_KV_OVERRIDE_BOOL:
|
||||
dest.BoolValue = _valueBool ? -1 : 0;
|
||||
dest.BoolValue = _valueBool ? -1L : 0;
|
||||
break;
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException();
|
||||
|
|
|
@ -21,22 +21,28 @@ public unsafe struct LLamaModelMetadataOverride
|
|||
public LLamaModelKvOverrideType Tag;
|
||||
|
||||
/// <summary>
|
||||
/// Value, **must** only be used if Tag == LLAMA_KV_OVERRIDE_INT
|
||||
/// Add 4 bytes of padding, to align the next fields to 8 bytes
|
||||
/// </summary>
|
||||
[FieldOffset(132)]
|
||||
private readonly int PADDING;
|
||||
|
||||
/// <summary>
|
||||
/// Value, **must** only be used if Tag == LLAMA_KV_OVERRIDE_INT
|
||||
/// </summary>
|
||||
[FieldOffset(136)]
|
||||
public long IntValue;
|
||||
|
||||
/// <summary>
|
||||
/// Value, **must** only be used if Tag == LLAMA_KV_OVERRIDE_FLOAT
|
||||
/// </summary>
|
||||
[FieldOffset(132)]
|
||||
[FieldOffset(136)]
|
||||
public double FloatValue;
|
||||
|
||||
/// <summary>
|
||||
/// Value, **must** only be used if Tag == LLAMA_KV_OVERRIDE_BOOL
|
||||
/// </summary>
|
||||
[FieldOffset(132)]
|
||||
public int BoolValue;
|
||||
[FieldOffset(136)]
|
||||
public long BoolValue;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
Loading…
Reference in New Issue