- Empty enums would return the values as zero sized arrays #2838

This commit is contained in:
Christoffer Lerno
2026-01-25 04:41:06 +01:00
parent 0fdd6bdc81
commit 109e15b5a0
8 changed files with 43 additions and 26 deletions

View File

@@ -1,5 +1,6 @@
<*
@require Enum.kindof == TypeKind.ENUM : "Only enums may be used with an enummap"
@require Enum.values.len > 0 : "Only non-empty enums may be used with enummap"
*>
module std::collections::enummap <Enum, ValueType>;
import std::io;

View File

@@ -1,16 +1,13 @@
// Copyright (c) 2025 Zack Puhl <github@xmit.xyz>. All rights reserved.
// Use of this source code is governed by the MIT license
// a copy of which can be found in the LICENSE_STDLIB file.
<*
@require @in(DIGEST_BITS, ...PERMISSIBLE_SIZES_BITS) : "Invalid DIGEST_BITS; must be one of {128, 160, 256, 320}."
*>
module std::hash::ripemd <DIGEST_BITS>;
module std::hash::ripemd;
const usz[4] PERMISSIBLE_SIZES_BITS = { 128, 160, 256, 320 };
<* Unchanging block size. *>
const BLOCK_SIZE = 64;
const usz[4] PERMISSIBLE_SIZES_BITS = { 128, 160, 256, 320 };
<* RIPE-MD initial values. *>
const uint[10] H = {
@@ -24,6 +21,11 @@ const uint[9] K = {
0x50a28be6, 0x5c4dd124, 0x6d703ef3, 0x7a6d76e9
};
<*
@require @in(DIGEST_BITS, ...PERMISSIBLE_SIZES_BITS) : "Invalid DIGEST_BITS; must be one of {128, 160, 256, 320}."
*>
module std::hash::ripemd <DIGEST_BITS>;
<* Ultimate digest's size in bytes. *>
const DIGEST_BYTES = DIGEST_BITS / 8;