Zig 0.17.0-dev (Split by item)

This is an example of documentation generated by ZigDoc, an alternative to Zig's built-in Auto Doc feature. See also examples in other modes/formats. The project being documented here (as the example) is the Zig library itself.

fromBytes

The function fromBytes deserializes a field element NOT in the Montgomery domain from bytes in little-endian order.

Preconditions: 0 ≤ bytes_eval arg1 < m Postconditions: eval out1 mod m = bytes_eval arg1 mod m 0 ≤ eval out1 < m

Input Bounds: arg1: [[0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff]] Output Bounds: out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]

p256_64.fromBytes
pub fn fromBytes(out1: *[4]u64, arg1: [32]u8) void

File

Code

pub fn fromBytes(out1: *[4]u64, arg1: [32]u8) void {
    @setRuntimeSafety(mode == .debug);

    const x1 = (@as(u64, (arg1[31])) << 56);
    const x2 = (@as(u64, (arg1[30])) << 48);
    const x3 = (@as(u64, (arg1[29])) << 40);
    const x4 = (@as(u64, (arg1[28])) << 32);
    const x5 = (@as(u64, (arg1[27])) << 24);
    const x6 = (@as(u64, (arg1[26])) << 16);
    const x7 = (@as(u64, (arg1[25])) << 8);
    const x8 = (arg1[24]);
    const x9 = (@as(u64, (arg1[23])) << 56);
    const x10 = (@as(u64, (arg1[22])) << 48);
    const x11 = (@as(u64, (arg1[21])) << 40);
    const x12 = (@as(u64, (arg1[20])) << 32);
    const x13 = (@as(u64, (arg1[19])) << 24);
    const x14 = (@as(u64, (arg1[18])) << 16);
    const x15 = (@as(u64, (arg1[17])) << 8);
    const x16 = (arg1[16]);
    const x17 = (@as(u64, (arg1[15])) << 56);
    const x18 = (@as(u64, (arg1[14])) << 48);
    const x19 = (@as(u64, (arg1[13])) << 40);
    const x20 = (@as(u64, (arg1[12])) << 32);
    const x21 = (@as(u64, (arg1[11])) << 24);
    const x22 = (@as(u64, (arg1[10])) << 16);
    const x23 = (@as(u64, (arg1[9])) << 8);
    const x24 = (arg1[8]);
    const x25 = (@as(u64, (arg1[7])) << 56);
    const x26 = (@as(u64, (arg1[6])) << 48);
    const x27 = (@as(u64, (arg1[5])) << 40);
    const x28 = (@as(u64, (arg1[4])) << 32);
    const x29 = (@as(u64, (arg1[3])) << 24);
    const x30 = (@as(u64, (arg1[2])) << 16);
    const x31 = (@as(u64, (arg1[1])) << 8);
    const x32 = (arg1[0]);
    const x33 = (x31 + @as(u64, x32));
    const x34 = (x30 + x33);
    const x35 = (x29 + x34);
    const x36 = (x28 + x35);
    const x37 = (x27 + x36);
    const x38 = (x26 + x37);
    const x39 = (x25 + x38);
    const x40 = (x23 + @as(u64, x24));
    const x41 = (x22 + x40);
    const x42 = (x21 + x41);
    const x43 = (x20 + x42);
    const x44 = (x19 + x43);
    const x45 = (x18 + x44);
    const x46 = (x17 + x45);
    const x47 = (x15 + @as(u64, x16));
    const x48 = (x14 + x47);
    const x49 = (x13 + x48);
    const x50 = (x12 + x49);
    const x51 = (x11 + x50);
    const x52 = (x10 + x51);
    const x53 = (x9 + x52);
    const x54 = (x7 + @as(u64, x8));
    const x55 = (x6 + x54);
    const x56 = (x5 + x55);
    const x57 = (x4 + x56);
    const x58 = (x3 + x57);
    const x59 = (x2 + x58);
    const x60 = (x1 + x59);
    out1[0] = x39;
    out1[1] = x46;
    out1[2] = x53;
    out1[3] = x60;
}