SameBoy | Accurate GB/GBC emulator |
| download: https://git.y1.nz/archives/sameboy.tar.gz | |
| README | Files | Log | Refs | LICENSE |
HexFiend/HFFullMemoryByteSlice.m
1 //
2 // HFFullMemoryByteSlice.m
3 // HexFiend_2
4 //
5 // Copyright 2007 ridiculous_fish. All rights reserved.
6 //
7
8 #import "HFFullMemoryByteSlice.h"
9
10
11 @implementation HFFullMemoryByteSlice
12
13 - (instancetype)initWithData:(NSData *)val {
14 REQUIRE_NOT_NULL(val);
15 self = [super init];
16 data = [val copy];
17 return self;
18 }
19
20 - (void)dealloc {
21 [data release];
22 [super dealloc];
23 }
24
25 - (unsigned long long)length { return [data length]; }
26
27 - (void)copyBytes:(unsigned char *)dst range:(HFRange)lrange {
28 NSRange range;
29 HFASSERT(lrange.location <= NSUIntegerMax);
30 HFASSERT(lrange.length <= NSUIntegerMax);
31 HFASSERT(lrange.location + lrange.length >= lrange.location);
32 range.location = ll2l(lrange.location);
33 range.length = ll2l(lrange.length);
34 [data getBytes:dst range:range];
35 }
36
37 - (HFByteSlice *)subsliceWithRange:(HFRange)range {
38 HFASSERT(range.length > 0);
39 HFASSERT(range.location < [self length]);
40 HFASSERT([self length] - range.location >= range.length);
41 HFASSERT(range.location <= NSUIntegerMax);
42 HFASSERT(range.length <= NSUIntegerMax);
43 return [[[[self class] alloc] initWithData:[data subdataWithRange:NSMakeRange(ll2l(range.location), ll2l(range.length))]] autorelease];
44 }
45
46 @end
This webpage is intended to be an accessible preview of this repository. To get a fuller picture, clone it and use the git CLI.