summaryrefslogtreecommitdiffstats
path: root/vendor/windows-metadata/src/imp.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 18:31:36 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 18:31:36 +0000
commite02c5b5930c2c9ba3e5423fe12e2ef0155017297 (patch)
treefd60ebbbb5299e16e5fca8c773ddb74f764760db /vendor/windows-metadata/src/imp.rs
parentAdding debian version 1.73.0+dfsg1-1. (diff)
downloadrustc-e02c5b5930c2c9ba3e5423fe12e2ef0155017297.tar.xz
rustc-e02c5b5930c2c9ba3e5423fe12e2ef0155017297.zip
Merging upstream version 1.74.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/windows-metadata/src/imp.rs')
-rw-r--r--vendor/windows-metadata/src/imp.rs43
1 files changed, 0 insertions, 43 deletions
diff --git a/vendor/windows-metadata/src/imp.rs b/vendor/windows-metadata/src/imp.rs
deleted file mode 100644
index 27a735a45..000000000
--- a/vendor/windows-metadata/src/imp.rs
+++ /dev/null
@@ -1,43 +0,0 @@
-#[repr(C)]
-#[derive(Default)]
-pub struct METADATA_HEADER {
- pub signature: u32,
- pub major_version: u16,
- pub minor_version: u16,
- pub reserved: u32,
- pub length: u32,
- pub version: [u8; 20],
- pub flags: u16,
- pub streams: u16,
-}
-
-pub const METADATA_SIGNATURE: u32 = 0x424A_5342;
-
-/// A coded index (see codes.rs) is a table index that may refer to different tables. The size of the column in memory
-/// must therefore be large enough to hold an index for a row in the largest possible table. This function determines
-/// this size for the given winmd file.
-pub fn coded_index_size(tables: &[usize]) -> usize {
- fn small(row_count: usize, bits: u8) -> bool {
- (row_count as u64) < (1u64 << (16 - bits))
- }
-
- fn bits_needed(value: usize) -> u8 {
- let mut value = value - 1;
- let mut bits: u8 = 1;
- while {
- value >>= 1;
- value != 0
- } {
- bits += 1;
- }
- bits
- }
-
- let bits_needed = bits_needed(tables.len());
-
- if tables.iter().all(|table| small(*table, bits_needed)) {
- 2
- } else {
- 4
- }
-}