mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-30 23:52:43 +00:00 
			
		
		
		
	 0f1f925532
			
		
	
	
		0f1f925532
		
	
	
	
	
		
			
			This patch does two things: - We now use u32 instead of size_t for the hops and index fields in EnvironmentCoordinate. This means we're limited to an environment nesting level and variable count of 4Gs respectively. - Instead of wrapping it in an Optional, EnvironmentCoordinate now has a custom valid/invalid state using a magic marker value. These two changes reduce the size of Identifier by 16 bytes. :^)
		
			
				
	
	
		
			24 lines
		
	
	
	
		
			493 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			24 lines
		
	
	
	
		
			493 B
		
	
	
	
		
			C++
		
	
	
	
	
	
| /*
 | |
|  * Copyright (c) 2021, Andreas Kling <kling@serenityos.org>
 | |
|  *
 | |
|  * SPDX-License-Identifier: BSD-2-Clause
 | |
|  */
 | |
| 
 | |
| #pragma once
 | |
| 
 | |
| #include <AK/Types.h>
 | |
| #include <LibJS/Forward.h>
 | |
| 
 | |
| namespace JS {
 | |
| 
 | |
| struct EnvironmentCoordinate {
 | |
|     u32 hops { invalid_marker };
 | |
|     u32 index { invalid_marker };
 | |
| 
 | |
|     bool is_valid() const { return hops != invalid_marker && index != invalid_marker; }
 | |
| 
 | |
|     static constexpr u32 global_marker = 0xffffffff;
 | |
|     static constexpr u32 invalid_marker = 0xfffffffe;
 | |
| };
 | |
| 
 | |
| }
 |