This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protocol AProtocol {} | |
protocol ABProtocol: AProtocol {} | |
struct ABStruct: ABProtocol {} | |
struct Wrapper<T> { | |
let object: T | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{ | |
UITableViewCell *cell = [self tableView:tableView cellForRowAtIndexPath:indexPath isOffscreen:YES]; | |
cell.bounds = CGRectMake(0.0f, 0.0f, CGRectGetWidth(tableView.bounds), 10000); | |
[cell updateConstraintsIfNeeded]; | |
[cell layoutIfNeeded]; | |
CGFloat heightText = cell.shows_lower_panel ? CGRectGetMaxY(cell.countImageView.frame) : MAX(CGRectGetMaxY(cell.circleImageView.frame), CGRectGetMaxY(ccc.titleLabel.frame)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <metal_stdlib> | |
using namespace metal; | |
// Every kernel processes 1 row of the char table: | |
kernel void lmCharSearch( | |
const device char *charTable [[ buffer(0) ]], | |
constant uint &charsInRow [[ buffer(1) ]], | |
constant uint &rowCount [[ buffer(2) ]], | |
const device char *searchPhrase [[ buffer(3) ]], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For stackoverflow question: | |
// http://stackoverflow.com/questions/30445801/ios8-metal-compute-pipeline-slower-than-cpu | |
// I. CODE INVOKED ONCE, AT THE INIT STAGE: | |
_mtlCharTable = [_mtlDevice newBufferWithBytes:_charTable->pointer length:_charTable->bytesTotal options:0]; | |
_mtlSearchMasks = [_mtlDevice newBufferWithBytesNoCopy:_searchIndexes.mask length:_searchIndexes.bytesTotalMask options:0 deallocator:nil]; | |
//iPhone 6: maxTotalThreadsPerThreadgroup: 512, threadExecutionWidth: 32 | |
uint threadsPerThreadGroup = [_mtlComputePipelineState maxTotalThreadsPerThreadgroup];// / 4.0; |