mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 03:51:18 +00:00
- Empty enums would return the values as zero sized arrays #2838
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user