This file contains hidden or 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
| library ieee; | |
| use ieee.std_logic_1164.all; | |
| use ieee.numeric_std.all; | |
| ENTITY alu IS | |
| PORT ( | |
| opcode : IN std_logic_vector (7 DOWNTO 0); | |
| in_0, in_1 : IN std_logic_vector (3 DOWNTO 0); | |
| output : OUT std_logic_vector (3 DOWNTO 0); | |
| equal_zero : OUT std_logic; |
This file contains hidden or 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
| //--------------------------------------------------------------------------------- | |
| // Framebuffer demo for Nintendo DS, using the libnds library | |
| //--------------------------------------------------------------------------------- | |
| #include <nds.h> | |
| void framebufferDemoDrawPattern() { | |
| int color = 0; | |
| for (int pixelPosition = 0; pixelPosition < SCREEN_HEIGHT*SCREEN_WIDTH; pixelPosition++) { | |
| VRAM_A[pixelPosition] = RGB15(color, color, color); |
This file contains hidden or 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 <stdlib.h> | |
| #include <stdio.h> | |
| #include <math.h> | |
| #include <mpi.h> | |
| #define PRIME_MAX 1000000 | |
| #define SEND_CHUNK_SIZE 10000 | |
| #define SAVE_CHUNK_SIZE 1000 |
This file contains hidden or 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
| extension Bool { | |
| var intValue: Int { | |
| if (self) { | |
| return 1; | |
| } else { | |
| return 0; | |
| } | |
| } | |
| } |
This file contains hidden or 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
| func binarySearch(list: [Int], value: Int) -> Int { | |
| let count = list.count | |
| var min: Int = 0 | |
| var max: Int = count | |
| var mid: Int = Int(round(Double(max / 2))) | |
| while(list[mid] != value) { | |
| if (list[mid] > value) { | |
| max = mid |
This file contains hidden or 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
| import Foundation | |
| class Board { | |
| // Board is quadratic | |
| var boardSize: Int = 0 | |
| // The raw array | |
| private var data: [[Int]] = [] | |