Пример #1
0
                        action='store_true',
                        help='always use the shufbytes method')
    parser.add_argument('--raw-name',
                        dest='raw_name',
                        action='store_true',
                        help='use minimal function name (square_N_821)')
    parser.set_defaults(patience=False)

    args = parser.parse_args()
    if args.shufbytes:
        f = functools.partial(square_821_shufbytes, n=args.no_of_squarings)
        if args.raw_name:
            f.__name__ = "square_{}_821".format(args.no_of_squarings)
        else:
            f.__name__ = "square_{}_821_shufbytes".format(args.no_of_squarings)
        print_memfunc(f, 4, 4, initialize=True)
    elif args.patience:
        f = functools.partial(square_821_patience,
                              n=args.no_of_squarings,
                              callee_saved=args.callee)
        if args.raw_name:
            f.__name__ = "square_{}_821".format(args.no_of_squarings)
        else:
            f.__name__ = "square_{}_821_patience".format(args.no_of_squarings)
        print_memfunc(f, 16, 16, per_reg=64)
    elif args.no_of_squarings in permutations:
        f = permutations[args.no_of_squarings]
        print_memfunc(f, 4, 4)
    else:
        raise NotImplementedError(
            "There is no dedicated implementation for {} squarings. "
Пример #2
0
                        action='store_true',
                        help='always use the shufbytes method')
    parser.add_argument('--raw-name',
                        dest='raw_name',
                        action='store_true',
                        help='use minimal function name (square_N_701)')
    parser.set_defaults(patience=False)

    args = parser.parse_args()
    if args.shufbytes:
        f = functools.partial(square_701_shufbytes, n=args.no_of_squarings)
        if args.raw_name:
            f.__name__ = "square_{}_701".format(args.no_of_squarings)
        else:
            f.__name__ = "square_{}_701_shufbytes".format(args.no_of_squarings)
        print_memfunc(f, 3, 3, initialize=True)
    elif args.patience:
        f = functools.partial(square_701_patience,
                              n=args.no_of_squarings,
                              callee_saved=args.callee)
        if args.raw_name:
            f.__name__ = "square_{}_701".format(args.no_of_squarings)
        else:
            f.__name__ = "square_{}_701_patience".format(args.no_of_squarings)
        print_memfunc(f, 12, 12, per_reg=64)
    elif args.no_of_squarings in permutations:
        f = permutations[args.no_of_squarings]
        print_memfunc(f, 3, 3)
    else:
        raise NotImplementedError(
            "There is no dedicated implementation for {} squarings. "
Пример #3
0
                        nargs='?',
                        dest='namespace',
                        default='',
                        help='namespace to prepend to the function name')
    parser.set_defaults(patience=False)

    args = parser.parse_args()
    if args.shufbytes:
        f = functools.partial(square_509_shufbytes, n=args.no_of_squarings)
        if args.raw_name:
            f.__name__ = "{}square_{}_509".format(args.namespace,
                                                  args.no_of_squarings)
        else:
            f.__name__ = "{}square_{}_509_shufbytes".format(
                args.namespace, args.no_of_squarings)
        print_memfunc(f, 2, 2, initialize=True)
    elif args.patience:
        f = functools.partial(square_509_patience,
                              n=args.no_of_squarings,
                              callee_saved=args.callee)
        if args.raw_name:
            f.__name__ = "{}square_{}_509".format(args.namespace,
                                                  args.no_of_squarings)
        else:
            f.__name__ = "{}square_{}_509_patience".format(
                args.namespace, args.no_of_squarings)
        print_memfunc(f, 8, 8, per_reg=64)
    else:
        raise NotImplementedError(
            "There is no dedicated implementation for {} squarings. "
            "Please specify either --shufbytes or --patience.".format(