Skip to content

Instantly share code, notes, and snippets.

View LYP951018's full-sized avatar

Yupei Liu LYP951018

  • Tencent
  • Shenzhen, Guangdong
View GitHub Profile
class Solution {
public:
bool wordBreak(string s, vector<string>& wordDict) {
if (s.empty())
{
return false;
}
if (wordDict.empty())
{
return false;
@LYP951018
LYP951018 / Main.cpp
Created September 27, 2019 12:21
ARM transpose blocking
void Rotate2701(const unsigned char* __restrict__ input, int width, int height,
unsigned char* __restrict__ output)
{
const std::uint32_t* inputPixels =
reinterpret_cast<const std::uint32_t*>(input);
std::uint32_t* outputPixels = reinterpret_cast<std::uint32_t*>(output);
const std::uint32_t kBlockPixelSize = 8;
const std::uint32_t rowBlockCount = width / kBlockPixelSize;
@LYP951018
LYP951018 / Main.cpp
Last active September 26, 2019 12:50
Transpose blocking
#define STB_IMAGE_IMPLEMENTATION
#define STB_IMAGE_WRITE_IMPLEMENTATION
#define _CRT_SECURE_NO_WARNINGS 1
#include <stb_image.h>
#include <stb_image_write.h>
#include <vector>
#include <chrono>
#include <iostream>
void Rotate2701(const unsigned char* input,
@LYP951018
LYP951018 / GaussianOffsetsCalculator.cs
Last active April 29, 2019 08:07
GaussianOffsetsCalculator
using System;
using System.Collections.Generic;
using System.Linq;
namespace GaussianOffsetsCalculator
{
class Program
{
private static long[] _fracCache = new long[30];
#include <type_traits>
#include <limits>
#include <cassert>
enum class uint32_t : unsigned int {};
constexpr uint32_t operator""_u32(unsigned long long x) {
using underlying = std::underlying_type_t<uint32_t>;
assert(static_cast<unsigned long long>(std::numeric_limits<underlying>::max()) >= x);
return uint32_t{static_cast<underlying>(x)};
@LYP951018
LYP951018 / Bind.cpp
Created June 10, 2017 16:26
Naive Bind
#include <type_traits>
#include <functional>
#include <tuple>
#include <utility>
#include <iostream>
#include <memory>
template<int I>
struct Placeholder
{
#define UNICODE
#include <string>
#include <experimental/generator>
#include <iostream>
#include <functional>
#include <string_view>
#include <Windows.h>
using namespace std::experimental;
@LYP951018
LYP951018 / Future.cpp
Last active May 30, 2017 12:49
NaiveFuture
#include <variant>
#include <functional>
#include <memory>
#include <iostream>
#include <thread>
#include <chrono>
#include <stdexcept>
#include <Windows.h>
using Win32Handle = std::unique_ptr<void, void (*)(void *) noexcept>;
#include <cstdint>
#include <Windows.h>
#include <cassert>
#include <thread>
#include <iostream>
struct Mutex
{
public:
void lock()
using System;
using System.Collections.Generic;
using System.Text;
using System.Diagnostics;
using System.Diagnostics.Contracts;
namespace Calculator
{
enum SyntaxKind
{